summaryrefslogtreecommitdiffstats
path: root/branches/sca-android/tuscany-assembly
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--branches/sca-android/tuscany-assembly-xml/.classpath40
-rw-r--r--branches/sca-android/tuscany-assembly-xml/.project30
-rw-r--r--branches/sca-android/tuscany-assembly-xml/.settings/org.eclipse.jdt.core.prefs5
-rw-r--r--branches/sca-android/tuscany-assembly-xml/DISCLAIMER8
-rw-r--r--branches/sca-android/tuscany-assembly-xml/LICENSE205
-rw-r--r--branches/sca-android/tuscany-assembly-xml/NOTICE6
-rw-r--r--branches/sca-android/tuscany-assembly-xml/pom.xml116
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java814
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.java122
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeModelResolver.java95
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java355
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java174
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeModelResolver.java83
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java989
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java104
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java95
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeDocumentProcessor.java121
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeModelResolver.java83
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java257
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/DefaultBeanModelProcessor.java246
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java263
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver20
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/BuildPolicyTestCase.java166
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/MockPolicyProcessor.java68
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java162
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadDocumentTestCase.java223
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadTestCase.java99
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolvePolicyTestCase.java198
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolveTestCase.java111
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestModelResolver.java63
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingFactoryImpl.java35
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java213
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java146
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java148
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite53
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType34
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType31
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/JavaScriptReference.composite37
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/RMIBindingTest.composite43
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllCalculator.composite128
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllDivide.composite56
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllPolicyCalculator.composite129
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/another_test_definitions.xml97
-rw-r--r--branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/test_definitions.xml175
-rw-r--r--branches/sca-android/tuscany-assembly/.classpath13
-rw-r--r--branches/sca-android/tuscany-assembly/.project18
-rw-r--r--branches/sca-android/tuscany-assembly/.settings/org.eclipse.jdt.core.prefs5
-rw-r--r--branches/sca-android/tuscany-assembly/DISCLAIMER8
-rw-r--r--branches/sca-android/tuscany-assembly/LICENSE205
-rw-r--r--branches/sca-android/tuscany-assembly/NOTICE6
-rw-r--r--branches/sca-android/tuscany-assembly/pom.xml50
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractContract.java77
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.java122
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractReference.java43
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractService.java28
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java155
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java43
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java63
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Callback.java40
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java132
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java88
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.java74
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentService.java59
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java77
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java110
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeReference.java37
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java56
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java59
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/ConstrainingType.java72
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java81
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.java31
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.java37
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java27
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Multiplicity.java49
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationsConfigurator.java33
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/OptimizableBinding.java66
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Property.java41
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java56
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java27
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABindingFactory.java36
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java29
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java67
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ComponentPreProcessor.java28
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java40
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.java45
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderMonitor.java36
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DomainBuilder.java80
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/Problem.java45
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingPolicyComputer.java262
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingUtil.java142
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java121
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java107
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java1417
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.java93
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java998
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/DomainWireBuilderImpl.java289
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ImplementationPolicyComputer.java134
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyComputationException.java36
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyComputer.java372
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtil.java273
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ProblemImpl.java112
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyUtil.java208
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceUtil.java94
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractPropertyImpl.java114
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractReferenceImpl.java46
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractServiceImpl.java36
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java121
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BaseImpl.java45
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java82
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java174
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java93
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.java86
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentServiceImpl.java71
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java115
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java143
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java51
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java62
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java91
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java105
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java91
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.java44
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java74
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/PropertyImpl.java59
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java116
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java99
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java96
-rw-r--r--branches/sca-android/tuscany-assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.AssemblyFactory18
-rw-r--r--branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java214
-rw-r--r--branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java55
-rw-r--r--branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java61
-rw-r--r--branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterface.java42
-rw-r--r--branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterfaceContract.java41
-rw-r--r--branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/TestOperation.java30
-rw-r--r--branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CalculateBindingURITestCase.java554
-rw-r--r--branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java128
-rw-r--r--branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java229
136 files changed, 0 insertions, 17184 deletions
diff --git a/branches/sca-android/tuscany-assembly-xml/.classpath b/branches/sca-android/tuscany-assembly-xml/.classpath
deleted file mode 100644
index 3f660b27c9..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/.classpath
+++ /dev/null
@@ -1,40 +0,0 @@
-<classpath>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
- <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
- <classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
- <classpathentry kind="output" path="target/classes"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="var" path="M2_REPO/junit/junit/4.2/junit-4.2.jar"/>
- <classpathentry kind="src" path="/tuscany-assembly"/>
- <classpathentry kind="src" path="/tuscany-policy"/>
- <classpathentry kind="src" path="/tuscany-extensibility"/>
- <classpathentry kind="src" path="/tuscany-interface"/>
- <classpathentry kind="src" path="/tuscany-definitions"/>
- <classpathentry kind="src" path="/tuscany-assembly-xsd"/>
- <classpathentry kind="src" path="/tuscany-contribution"/>
- <classpathentry kind="var" path="M2_REPO/stax/stax-api/1.0.1/stax-api-1.0.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.3.03/xml-apis-1.3.03.jar"/>
- <classpathentry kind="src" path="/tuscany-contribution-impl"/>
- <classpathentry kind="src" path="/tuscany-contribution-xml"/>
- <classpathentry kind="var" path="M2_REPO/org/codehaus/woodstox/wstx-asl/3.2.1/wstx-asl-3.2.1.jar"/>
- <classpathentry kind="src" path="/tuscany-contribution-java"/>
- <classpathentry kind="src" path="/tuscany-core-spi"/>
- <classpathentry kind="src" path="/tuscany-sca-api"/>
- <classpathentry kind="src" path="/tuscany-contribution-namespace"/>
- <classpathentry kind="src" path="/tuscany-contribution-resource"/>
- <classpathentry kind="src" path="/tuscany-definitions-xml"/>
- <classpathentry kind="src" path="/tuscany-policy-xml"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/ws/commons/axiom/axiom-api/1.2.5/axiom-api-1.2.5.jar"/>
- <classpathentry kind="var" path="M2_REPO/jaxen/jaxen/1.1-beta-9/jaxen-1.1-beta-9.jar"/>
- <classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.8.1/xercesImpl-2.8.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/neethi/neethi/2.0.2/neethi-2.0.2.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/ws/commons/axiom/axiom-impl/1.2.5/axiom-impl-1.2.5.jar"/>
- <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1/commons-logging-1.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.12/log4j-1.2.12.jar"/>
- <classpathentry kind="var" path="M2_REPO/logkit/logkit/1.0.1/logkit-1.0.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/avalon-framework/avalon-framework/4.1.3/avalon-framework-4.1.3.jar"/>
- <classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.3/servlet-api-2.3.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/easymock/easymock/2.2/easymock-2.2.jar"/>
- <classpathentry kind="var" path="M2_REPO/xalan/xalan/2.7.0/xalan-2.7.0.jar"/>
-</classpath> \ No newline at end of file
diff --git a/branches/sca-android/tuscany-assembly-xml/.project b/branches/sca-android/tuscany-assembly-xml/.project
deleted file mode 100644
index 975169eed5..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/.project
+++ /dev/null
@@ -1,30 +0,0 @@
-<projectDescription>
- <name>tuscany-assembly-xml</name>
- <comment>Parent POM defining settings that can be used across Tuscany</comment>
- <projects>
- <project>tuscany-assembly</project>
- <project>tuscany-policy</project>
- <project>tuscany-extensibility</project>
- <project>tuscany-interface</project>
- <project>tuscany-definitions</project>
- <project>tuscany-assembly-xsd</project>
- <project>tuscany-contribution</project>
- <project>tuscany-contribution-impl</project>
- <project>tuscany-contribution-xml</project>
- <project>tuscany-contribution-java</project>
- <project>tuscany-core-spi</project>
- <project>tuscany-sca-api</project>
- <project>tuscany-contribution-namespace</project>
- <project>tuscany-contribution-resource</project>
- <project>tuscany-definitions-xml</project>
- <project>tuscany-policy-xml</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription> \ No newline at end of file
diff --git a/branches/sca-android/tuscany-assembly-xml/.settings/org.eclipse.jdt.core.prefs b/branches/sca-android/tuscany-assembly-xml/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 33e67d2469..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,5 +0,0 @@
-#Thu Mar 20 19:20:00 PDT 2008
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.source=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
diff --git a/branches/sca-android/tuscany-assembly-xml/DISCLAIMER b/branches/sca-android/tuscany-assembly-xml/DISCLAIMER
deleted file mode 100644
index d68a410903..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/DISCLAIMER
+++ /dev/null
@@ -1,8 +0,0 @@
-Apache Tuscany is an effort undergoing incubation at The Apache Software
-Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is
-required of all newly accepted projects until a further review indicates that
-the infrastructure, communications, and decision making process have stabilized
-in a manner consistent with other successful ASF projects. While incubation
-status is not necessarily a reflection of the completeness or stability of the
-code, it does indicate that the project has yet to be fully endorsed by the ASF.
-
diff --git a/branches/sca-android/tuscany-assembly-xml/LICENSE b/branches/sca-android/tuscany-assembly-xml/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/LICENSE
+++ /dev/null
@@ -1,205 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
-
diff --git a/branches/sca-android/tuscany-assembly-xml/NOTICE b/branches/sca-android/tuscany-assembly-xml/NOTICE
deleted file mode 100644
index 1325efd8bf..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${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/branches/sca-android/tuscany-assembly-xml/pom.xml b/branches/sca-android/tuscany-assembly-xml/pom.xml
deleted file mode 100644
index 1580311fff..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/pom.xml
+++ /dev/null
@@ -1,116 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for 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>2.0-incubating-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>2.0-incubating-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-definitions-xml</artifactId>
- <version>2.0-incubating-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-definitions</artifactId>
- <version>2.0-incubating-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>2.0-incubating-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-namespace</artifactId>
- <version>2.0-incubating-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-java</artifactId>
- <version>2.0-incubating-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-impl</artifactId>
- <version>2.0-incubating-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy</artifactId>
- <version>2.0-incubating-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy-xml</artifactId>
- <version>2.0-incubating-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- <version>1.0.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>wstx-asl</artifactId>
- <version>3.2.1</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>xalan</groupId>
- <artifactId>xalan</artifactId>
- <version>2.7.0</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xsd</artifactId>
- <version>2.0-incubating-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-</project>
diff --git a/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java b/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
deleted file mode 100644
index b94d9e0927..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
+++ /dev/null
@@ -1,814 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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.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.contribution.ContributionFactory;
-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.interfacedef.InterfaceContract;
-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: 643489 $ $Date: 2008-04-01 10:06:42 -0800 (Tue, 01 Apr 2008) $
- */
-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;
-
- /**
- * Constructs a new BaseArtifactProcessor.
- * @param contribFactory
- * @param factory
- * @param policyFactory
- */
- @SuppressWarnings("unchecked")
- public BaseAssemblyProcessor(ContributionFactory contribFactory,
- AssemblyFactory factory,
- PolicyFactory policyFactory,
- StAXArtifactProcessor extensionProcessor) {
- this.assemblyFactory = factory;
- this.policyFactory = policyFactory;
- this.extensionProcessor = (StAXArtifactProcessor<Object>)extensionProcessor;
- this.contributionFactory = contribFactory;
- this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
- this.intentAttachPointTypeFactory = new IntentAttachPointTypeFactoryImpl();
- }
-
- /**
- * Constructs a new BaseArtifactProcessor.
- * @param factory
- * @param policyFactory
- */
- @SuppressWarnings("unchecked")
- public BaseAssemblyProcessor(AssemblyFactory factory,
- PolicyFactory policyFactory,
- StAXArtifactProcessor extensionProcessor) {
- this.assemblyFactory = factory;
- this.policyFactory = policyFactory;
- this.extensionProcessor = (StAXArtifactProcessor<Object>)extensionProcessor;
- this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
- }
-
- /**
- * 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().toString() : "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 policy intents and policysets
- if ( parent != null && parent instanceof PolicySetAttachPoint ) {
- addInheritedIntents(((PolicySetAttachPoint)parent).getRequiredIntents(), contract.getRequiredIntents());
- addInheritedPolicySets(((PolicySetAttachPoint)parent).getPolicySets(), contract.getPolicySets());
- addInheritedPolicySets(((PolicySetAttachPoint)parent).getApplicablePolicySets(), contract.getApplicablePolicySets());
- }
-
- for ( ConfiguredOperation confOp : contract.getConfiguredOperations() ) {
- resolveIntents(confOp.getRequiredIntents(), resolver);
- resolvePolicySets(confOp.getPolicySets(), resolver);
- resolvePolicySets(confOp.getApplicablePolicySets(), resolver);
-
- //inherit intents and policysets from parent contract
- addInheritedIntents(contract.getRequiredIntents(), confOp.getRequiredIntents());
- addInheritedPolicySets(contract.getPolicySets(), confOp.getPolicySets());
- 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().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());
-
- addInheritedIntents(((PolicySetAttachPoint)binding).getRequiredIntents(),
- confOp.getRequiredIntents());
- addInheritedPolicySets(((PolicySetAttachPoint)binding).getPolicySets(),
- confOp.getPolicySets());
- }
- }
- }
-
- // 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
- addInheritedIntents(contract.getRequiredIntents(), contract.getCallback().getRequiredIntents());
- addInheritedPolicySets(contract.getPolicySets(), contract.getCallback().getPolicySets());
- 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 ) {
- 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) {
- throw new ContributionReadException(e);
- }
-
- // 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) {
- resolvedPolicySet = resolver.resolveModel(PolicySet.class, policySet);
- resolvedPolicySets.add(resolvedPolicySet);
- }
- 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);
- }
- }
-
-
- /*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/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.java b/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.java
deleted file mode 100644
index 2950ef5a04..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.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.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-
-/**
- * A componentType processor.
- *
- * @version $Rev: 635373 $ $Date: 2008-03-09 14:51:51 -0700 (Sun, 09 Mar 2008) $
- */
-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) {
- super(null, null, staxProcessor);
- this.inputFactory = inputFactory;
- }
-
- 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) {
- throw new ContributionReadException(e);
- } catch (IOException e) {
- throw new ContributionReadException(e);
- } finally {
- try {
- if (urlStream != null) {
- urlStream.close();
- urlStream = null;
- }
- } catch (IOException ioe) {
- //ignore
- }
- }
- }
-
- public void resolve(ComponentType componentType, ModelResolver resolver) throws ContributionResolveException {
- extensionProcessor.resolve(componentType, resolver);
- }
-
- public String getArtifactType() {
- return ".componentType";
- }
-
- public Class<ComponentType> getModelType() {
- return ComponentType.class;
- }
-}
diff --git a/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeModelResolver.java b/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeModelResolver.java
deleted file mode 100644
index 241e18badf..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeModelResolver.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.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: 631056 $ $Date: 2008-02-25 17:28:13 -0800 (Mon, 25 Feb 2008) $
- */
-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/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java b/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java
deleted file mode 100644
index 760e202ed2..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java
+++ /dev/null
@@ -1,355 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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.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.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: 637192 $ $Date: 2008-03-14 11:13:01 -0700 (Fri, 14 Mar 2008) $
- */
-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) {
- super(factory, policyFactory, extensionProcessor);
- }
-
- 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.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/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java b/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java
deleted file mode 100644
index 2f3f66e14f..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.util.PolicyComputationUtils;
-
-/**
- * A composite processor.
- *
- * @version $Rev: 643489 $ $Date: 2008-04-01 10:06:42 -0800 (Tue, 01 Apr 2008) $
- */
-public class CompositeDocumentProcessor extends BaseAssemblyProcessor implements URLArtifactProcessor<Composite> {
- private XMLInputFactory inputFactory;
- private List scaDefnSink;
- private Collection<PolicySet> domainPolicySets = null;
- private int scaDefnsCount = 0;
-
- /**
- * Construct a new composite processor
- * @param assemblyFactory
- * @param policyFactory
- * @param staxProcessor
- */
- public CompositeDocumentProcessor(StAXArtifactProcessor staxProcessor, XMLInputFactory inputFactory, List scaDefnsSink) {
- super(null, null, staxProcessor);
- this.inputFactory = inputFactory;
- this.scaDefnSink = scaDefnsSink;
- }
-
- public Composite read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
- InputStream scdlStream = null;
- try {
- if (scaDefnSink != null ) {
- fillDomainPolicySets(scaDefnSink);
- }
-
-
- byte[] transformedArtifactContent = null;
- try {
- if ( domainPolicySets != null ) {
- transformedArtifactContent =
- PolicyComputationUtils.addApplicablePolicySets(url, domainPolicySets);
- scdlStream = new ByteArrayInputStream(transformedArtifactContent);
- } else {
- URLConnection connection = url.openConnection();
- connection.setUseCaches(false);
- scdlStream = connection.getInputStream();
- }
- } catch ( Exception e ) {
- throw new ContributionReadException(e);
- }
-
- XMLStreamReader reader = inputFactory.createXMLStreamReader(scdlStream);
-
- reader.nextTag();
-
- // Read the composite model
- Composite 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) {
- throw new ContributionReadException(e);
- } finally {
- try {
- if (scdlStream != null) {
- scdlStream.close();
- scdlStream = null;
- }
- } catch (IOException ioe) {
- //ignore
- }
- }
- }
-
- public void resolve(Composite composite, ModelResolver resolver) throws ContributionResolveException {
- extensionProcessor.resolve(composite, resolver);
- }
-
- public String getArtifactType() {
- return ".composite";
- }
-
- public Class<Composite> getModelType() {
- return Composite.class;
- }
-
- 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/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeModelResolver.java b/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeModelResolver.java
deleted file mode 100644
index e939fe2c05..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeModelResolver.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.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: 572482 $ $Date: 2007-09-03 18:28:31 -0700 (Mon, 03 Sep 2007) $
- */
-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/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java b/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
deleted file mode 100644
index c74c5bfb5b..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
+++ /dev/null
@@ -1,989 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.xml;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import java.util.ArrayList;
-import java.util.List;
-import 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.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.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.PolicyValidationException;
-import org.apache.tuscany.sca.policy.util.PolicyValidationUtils;
-import org.w3c.dom.Document;
-
-/**
- * A composite processor.
- *
- * @version $Rev: 639226 $ $Date: 2008-03-20 02:45:37 -0700 (Thu, 20 Mar 2008) $
- */
-public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArtifactProcessor<Composite> {
- // FIXME: to be refactored
- // private XPathFactory xPathFactory = XPathFactory.newInstance();
-
- /**
- * Construct a new composite processor
- *
- * @param contributionFactory
- * @param assemblyFactory
- * @param policyFactory
- * @param extensionProcessor
- */
- public CompositeProcessor(ContributionFactory contributionFactory,
- AssemblyFactory factory,
- PolicyFactory policyFactory,
- InterfaceContractMapper interfaceContractMapper,
- StAXArtifactProcessor extensionProcessor) {
- super(contributionFactory, factory, policyFactory, extensionProcessor);
-
- }
-
- /**
- * Construct a new composite processor
- *
- * @param contributionFactory
- * @param assemblyFactory
- * @param policyFactory
- * @param extensionProcessor
- */
- public CompositeProcessor(ContributionFactory contributionFactory,
- AssemblyFactory factory,
- PolicyFactory policyFactory,
- StAXArtifactProcessor extensionProcessor) {
- super(contributionFactory, factory, policyFactory, extensionProcessor);
- }
-
- 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, AUTOWIRE)) {
- composite.setAutowire(getBoolean(reader, AUTOWIRE));
- }
- 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));
- 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);
- 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);
-
- 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));
- 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));
- 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 = ".";
- }
- }
-
- throw new IllegalArgumentException("not implemented in Android!");
-
- /* XPath xpath = xPathFactory.newXPath();
- xpath.setNamespaceContext(reader.getNamespaceContext());
- try {
- componentProperty.setSourceXPathExpression(xpath.compile(source));
- } catch (XPathExpressionException e) {
- throw new ContributionReadException(e);
- }*/
- }
- componentProperty.setFile(getString(reader, FILE));
- 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));
- }
- 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);
-
- composite.getWires().add(wire);
- policyProcessor.readPolicies(wire, reader);
-
- } else if (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>
- 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);
- 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)) {
- 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)) {
- 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)) {
- 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 <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));
- 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.getService();
- } else {
- promote = promotedComponent.getName();
- }
- } else {
- promote = null;
- }
- writeStart(writer, SERVICE, new XAttr(NAME, service.getName()), new XAttr(PROMOTE, promote),
- policyProcessor.writePolicies(service));
-
- // 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 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 the component implementation
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
- writeStart(writer, IMPLEMENTATION_COMPOSITE, new XAttr(NAME, composite.getName()));
- writeEnd(writer);
- } else {
- extensionProcessor.write(component.getImplementation(), writer);
- }
-
- // Write <service> elements
- for (ComponentService service : component.getServices()) {
- writeStart(writer, SERVICE, new XAttr(NAME, service.getName()),
- policyProcessor.writePolicies(service));
-
- // 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 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 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 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 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 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 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 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 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 policysets first as they are going to be copied over
- //to child elements as and when the child elements are being resolved
- List<Intent> compositeIntents = null;
- List<PolicySet> compositePolicySets = null;
- List<PolicySet> compositeApplicablePolicySets = null;
- if (composite instanceof PolicySetAttachPoint) {
- resolveIntents(((PolicySetAttachPoint)composite).getRequiredIntents(), resolver);
- resolvePolicySets(((PolicySetAttachPoint)composite).getPolicySets(), resolver);
- resolvePolicySets(((PolicySetAttachPoint)composite).getApplicablePolicySets(), resolver);
- compositeIntents = ((PolicySetAttachPoint)composite).getRequiredIntents();
- compositePolicySets = ((PolicySetAttachPoint)composite).getPolicySets();
- compositeApplicablePolicySets = ((PolicySetAttachPoint)composite).getApplicablePolicySets();
- } else {
- compositeIntents = new ArrayList<Intent>();
- compositePolicySets = new ArrayList<PolicySet>();
- compositeApplicablePolicySets = new ArrayList<PolicySet>();
- }
-
- //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 policysets first as they are going to be copied over
- //to child elements as and when the child elements are being resolved
- resolveIntents(component.getRequiredIntents(), resolver);
- resolvePolicySets(component.getPolicySets(), resolver);
- resolvePolicySets(component.getApplicablePolicySets(), resolver);
-
- //inherit composite intents and policysets
- addInheritedIntents(compositeIntents, component.getRequiredIntents());
- addInheritedPolicySets(compositePolicySets, 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 ) {
- throw new ContributionResolveException("PolicyValidation exception when processing implementation of component '"
- + component.getName() + "' due to " + e.getMessage(), e);
- }
-
- }
- }
- }
-
- 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());
-
- addInheritedIntents(((PolicySetAttachPoint)implementation).getRequiredIntents(),
- implConfOp.getRequiredIntents());
- addInheritedPolicySets(((PolicySetAttachPoint)implementation).getPolicySets(),
- 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 instance are
- //reused and its likely that this implementation instance will not hold after its resolution
- 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;
- addInheritedIntents(implConfOp.getRequiredIntents(), compConfOp.getRequiredIntents());
- addInheritedPolicySets(implConfOp.getPolicySets(), compConfOp.getPolicySets());
- addInheritedPolicySets(implConfOp.getApplicablePolicySets(), compConfOp.getApplicablePolicySets());
- notFound = false;
- }
- }
-
- 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;
- }
-}
diff --git a/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java b/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java
deleted file mode 100644
index 43e0242b7e..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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;
-
-/**
- * Processor for dealing with 'operation' elements from composite definitions
- */
-public class ConfiguredOperationProcessor implements StAXArtifactProcessor<ConfiguredOperation>, Constants{
-
- private AssemblyFactory assemblyFactory;
- private PolicyAttachPointProcessor policyProcessor;
- private PolicyFactory policyFactory;
-
- public ConfiguredOperationProcessor(ModelFactoryExtensionPoint modelFactories) {
- this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
- this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
- }
-
- 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/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java b/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java
deleted file mode 100644
index 3f471838fc..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.xml;
-
-import javax.xml.namespace.QName;
-
-/**
- * Constants used in SCA assembly XML files.
- */
-public interface Constants {
- String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
- String 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/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeDocumentProcessor.java b/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeDocumentProcessor.java
deleted file mode 100644
index 8e441f14d3..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeDocumentProcessor.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.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 javax.xml.validation.Schema;
-
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-
-/**
- * A contrainingType content handler.
- *
- * @version $Rev: 635373 $ $Date: 2008-03-09 14:51:51 -0700 (Sun, 09 Mar 2008) $
- */
-public class ConstrainingTypeDocumentProcessor extends BaseAssemblyProcessor implements URLArtifactProcessor<ConstrainingType> {
- private XMLInputFactory inputFactory;
- private Schema schema;
-
- /**
- * Construct a new constrainingType processor.
- * @param factory
- * @param policyFactory
- * @param staxProcessor
- */
- public ConstrainingTypeDocumentProcessor(StAXArtifactProcessor staxProcessor, XMLInputFactory inputFactory) {
- super(null, null, staxProcessor);
- this.inputFactory = inputFactory;
- }
-
- public ConstrainingType read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
- InputStream urlStream = null;
- try {
-
- // 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) {
- throw new ContributionReadException(e);
- } catch (IOException e) {
- throw new ContributionReadException(e);
- } finally {
- try {
- if (urlStream != null) {
- urlStream.close();
- urlStream = null;
- }
- } catch (IOException ioe) {
- //ignore
- }
- }
- }
-
- public void resolve(ConstrainingType constrainingType, ModelResolver resolver) throws ContributionResolveException {
- extensionProcessor.resolve(constrainingType, resolver);
- }
-
- public String getArtifactType() {
- return ".constrainingType";
- }
-
- public Class<ConstrainingType> getModelType() {
- return ConstrainingType.class;
- }
-}
diff --git a/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeModelResolver.java b/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeModelResolver.java
deleted file mode 100644
index 8ba293d755..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeModelResolver.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.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: 572482 $ $Date: 2007-09-03 18:28:31 -0700 (Mon, 03 Sep 2007) $
- */
-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/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java b/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java
deleted file mode 100644
index a4200a3881..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.xml;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.AbstractContract;
-import org.apache.tuscany.sca.assembly.AbstractProperty;
-import org.apache.tuscany.sca.assembly.AbstractReference;
-import org.apache.tuscany.sca.assembly.AbstractService;
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.w3c.dom.Document;
-
-/**
- * A constrainingType processor.
- *
- * @version $Rev: 637192 $ $Date: 2008-03-14 11:13:01 -0700 (Fri, 14 Mar 2008) $
- */
-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) {
- super(factory, policyFactory, extensionProcessor);
- }
-
- 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.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/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/DefaultBeanModelProcessor.java b/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/DefaultBeanModelProcessor.java
deleted file mode 100644
index c862a6f127..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/DefaultBeanModelProcessor.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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.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;
-
-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) {
- super(assemblyFactory, policyFactory, null);
- 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) {
- throw new ContributionReadException(e);
- }
- }
-
- 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) {
- throw new ContributionWriteException(e);
- }
- }
-
- 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/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java b/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java
deleted file mode 100644
index 7fd642221b..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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.assembly.Binding;
-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.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-
-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/branches/sca-android/tuscany-assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver b/branches/sca-android/tuscany-assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
deleted file mode 100644
index ecc34942f1..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
+++ /dev/null
@@ -1,20 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT 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/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/BuildPolicyTestCase.java b/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/BuildPolicyTestCase.java
deleted file mode 100644
index 360cfbbacc..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/BuildPolicyTestCase.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.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 javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.assembly.OperationsConfigurator;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultURLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.definitions.xml.SCADefinitionsDocumentProcessor;
-import org.apache.tuscany.sca.definitions.xml.SCADefinitionsProcessor;
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
-import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
-import org.apache.tuscany.sca.policy.IntentAttachPoint;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.policy.xml.PolicySetProcessor;
-import org.apache.tuscany.sca.policy.xml.ProfileIntentProcessor;
-import org.apache.tuscany.sca.policy.xml.QualifiedIntentProcessor;
-import org.apache.tuscany.sca.policy.xml.SimpleIntentProcessor;
-
-/**
- * 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 ExtensibleURLArtifactProcessor documentProcessor;
- private TestModelResolver resolver;
- private SCADefinitionsDocumentProcessor scaDefnDocProcessor;
- private CompositeBuilder compositeBuilder;
- private Composite composite;
-
- @Override
- public void setUp() throws Exception {
- List scaDefnSink = new ArrayList();
- AssemblyFactory factory = new DefaultAssemblyFactory();
- PolicyFactory policyFactory = new DefaultPolicyFactory();
- resolver = new TestModelResolver();
- compositeBuilder = new CompositeBuilderImpl(factory, new TestSCABindingFactoryImpl(), new DefaultIntentAttachPointTypeFactory(), new InterfaceContractMapperImpl(), null);
- URLArtifactProcessorExtensionPoint documentProcessors = new DefaultURLArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
- documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors);
-
- // Create StAX processors
- DefaultStAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
- ExtensibleStAXArtifactProcessor staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
- staxProcessors.addArtifactProcessor(new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor));
- staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
- staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
- staxProcessors.addArtifactProcessor(new SCADefinitionsProcessor(policyFactory, staxProcessor, resolver));
- staxProcessors.addArtifactProcessor(new SimpleIntentProcessor(policyFactory, staxProcessor));
- staxProcessors.addArtifactProcessor(new ProfileIntentProcessor(policyFactory, staxProcessor));
- staxProcessors.addArtifactProcessor(new QualifiedIntentProcessor(policyFactory, staxProcessor));
- staxProcessors.addArtifactProcessor(new PolicySetProcessor(policyFactory, staxProcessor));
- staxProcessors.addArtifactProcessor(new MockPolicyProcessor());
-
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-
- // Create document processors
- documentProcessors.addArtifactProcessor(new CompositeDocumentProcessor(staxProcessor, inputFactory, scaDefnSink));
- documentProcessors.addArtifactProcessor(new ComponentTypeDocumentProcessor(staxProcessor, inputFactory));
- documentProcessors.addArtifactProcessor(new ConstrainingTypeDocumentProcessor(staxProcessor, inputFactory));
- scaDefnDocProcessor = new SCADefinitionsDocumentProcessor(staxProcessors, staxProcessor, inputFactory, policyFactory);
- documentProcessors.addArtifactProcessor(scaDefnDocProcessor);
-
- 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 scaDefns = (SCADefinitions)scaDefnDocProcessor.read(null, uri, url);
- assertNotNull(scaDefns);
- scaDefnSink.add(scaDefns);
-
- //preResolvePolicyTests(composite);
- documentProcessor.resolve(scaDefns, resolver);
- documentProcessor.resolve(composite, resolver);
- //postResolvePolicyTests(composite);
-
- compositeBuilder.build(composite);
- }
-
- @Override
- public void tearDown() throws Exception {
- documentProcessor = null;
- resolver = null;
- }
-
- 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/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/MockPolicyProcessor.java b/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/MockPolicyProcessor.java
deleted file mode 100644
index 2ee4abd99a..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/MockPolicyProcessor.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.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;
-
-public class MockPolicyProcessor 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/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java b/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java
deleted file mode 100644
index ffd88cc4a4..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.xml;
-
-import java.io.InputStream;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Callback;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.CompositeReference;
-import org.apache.tuscany.sca.assembly.CompositeService;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * Test reading SCA XML assemblies.
- *
- * @version $Rev: 638855 $ $Date: 2008-03-19 08:04:32 -0700 (Wed, 19 Mar 2008) $
- */
-public class ReadAllTestCase extends TestCase {
- private ExtensibleStAXArtifactProcessor staxProcessor;
-
- @Override
- public void setUp() throws Exception {
- AssemblyFactory factory = new DefaultAssemblyFactory();
- PolicyFactory policyFactory = new DefaultPolicyFactory();
- ContributionFactory contributionFactory = new DefaultContributionFactory();
-
- StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
-
- staxProcessors.addArtifactProcessor(new CompositeProcessor(contributionFactory, factory, policyFactory, staxProcessor));
- staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
- staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
- }
-
- @Override
- public void tearDown() throws Exception {
- }
-
- public void testReadComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("TestAllCalculator.composite");
- Composite composite = (Composite)staxProcessor.read(is, Composite.class);
- assertNotNull(composite);
- assertEquals(composite.getName(), new QName("http://calc", "TestAllCalculator"));
- assertEquals(composite.getConstrainingType().getName(), new QName("http://calc", "CalculatorComponent"));
- assertTrue(composite.isLocal());
- assertFalse(composite.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
-
- //new PrintUtil(System.out).print(composite);
- }
-
-}
diff --git a/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadDocumentTestCase.java b/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadDocumentTestCase.java
deleted file mode 100644
index 4fe068142d..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadDocumentTestCase.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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.stream.XMLOutputFactory;
-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.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultURLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.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.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint;
-import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
-
-/**
- * Test reading SCA XML assembly documents.
- *
- * @version $Rev: 639226 $ $Date: 2008-03-20 02:45:37 -0700 (Thu, 20 Mar 2008) $
- */
-public class ReadDocumentTestCase extends TestCase {
-
- private ExtensibleURLArtifactProcessor documentProcessor;
- private TestModelResolver resolver;
- private XMLInputFactory inputFactory;
- private ExtensibleStAXArtifactProcessor staxProcessor;
-
- @Override
- public void setUp() throws Exception {
- AssemblyFactory factory = new DefaultAssemblyFactory();
- PolicyFactory policyFactory = new DefaultPolicyFactory();
-
- URLArtifactProcessorExtensionPoint documentProcessors = new DefaultURLArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
- documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors);
-
- // Create StAX processors
- DefaultStAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
- staxProcessors.addArtifactProcessor(new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor));
- staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
- staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
-
- inputFactory = XMLInputFactory.newInstance();
- documentProcessors.addArtifactProcessor(new CompositeDocumentProcessor(staxProcessor, inputFactory, null));
- documentProcessors.addArtifactProcessor(new ComponentTypeDocumentProcessor(staxProcessor, inputFactory));
- documentProcessors.addArtifactProcessor(new ConstrainingTypeDocumentProcessor(staxProcessor, inputFactory));
-
- resolver = new TestModelResolver();
- }
-
- @Override
- public void tearDown() throws Exception {
- }
-
- 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);
- CompositeDocumentProcessor compositeDocumentProcessor = new CompositeDocumentProcessor(staxProcessor, validatingInputFactory, 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);
- CompositeDocumentProcessor compositeDocumentProcessor = new CompositeDocumentProcessor(staxProcessor, validatingInputFactory, 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/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadTestCase.java b/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadTestCase.java
deleted file mode 100644
index 5ead95df9d..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadTestCase.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.xml;
-
-import java.io.InputStream;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-
-/**
- * Test reading SCA XML assemblies.
- *
- * @version $Rev: 638855 $ $Date: 2008-03-19 08:04:32 -0700 (Wed, 19 Mar 2008) $
- */
-public class ReadTestCase extends TestCase {
-
- private XMLInputFactory inputFactory;
- private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
- private ExtensibleStAXArtifactProcessor staxProcessor;
- private AssemblyFactory factory;
- private PolicyFactory policyFactory;
-
- @Override
- public void setUp() throws Exception {
- factory = new DefaultAssemblyFactory();
- policyFactory = new DefaultPolicyFactory();
- inputFactory = XMLInputFactory.newInstance();
- staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
- }
-
- @Override
- public void tearDown() throws Exception {
- }
-
- public void testReadComponentType() throws Exception {
- ComponentTypeProcessor componentTypeReader = new ComponentTypeProcessor(factory, policyFactory, staxProcessor);
- InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- assertNotNull(componentTypeReader.read(reader));
- is.close();
- }
-
- public void testReadConstrainingType() throws Exception {
- InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
- ConstrainingTypeProcessor constrainingTypeReader = new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor);
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- assertNotNull(constrainingTypeReader.read(reader));
- is.close();
-
- }
-
- public void testReadComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("Calculator.composite");
- CompositeProcessor compositeReader = new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor);
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- assertNotNull(compositeReader.read(reader));
- is.close();
-
- }
-
- public void testReadCompositeAndWireIt() throws Exception {
- InputStream is = getClass().getResourceAsStream("Calculator.composite");
- CompositeProcessor compositeReader = new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor);
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- assertNotNull(compositeReader.read(reader));
- is.close();
- }
-
-}
diff --git a/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolvePolicyTestCase.java b/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolvePolicyTestCase.java
deleted file mode 100644
index 6db364950a..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolvePolicyTestCase.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.xml;
-
-import java.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultURLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.definitions.xml.SCADefinitionsDocumentProcessor;
-import org.apache.tuscany.sca.definitions.xml.SCADefinitionsProcessor;
-import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.policy.xml.PolicySetProcessor;
-import org.apache.tuscany.sca.policy.xml.ProfileIntentProcessor;
-import org.apache.tuscany.sca.policy.xml.QualifiedIntentProcessor;
-import org.apache.tuscany.sca.policy.xml.SimpleIntentProcessor;
-
-/**
- * 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 ExtensibleURLArtifactProcessor documentProcessor;
- private TestModelResolver resolver;
- SCADefinitionsDocumentProcessor scaDefnDocProcessor;
-
- @Override
- public void setUp() throws Exception {
- List scaDefnSink = new ArrayList();
- AssemblyFactory factory = new DefaultAssemblyFactory();
- PolicyFactory policyFactory = new DefaultPolicyFactory();
- resolver = new TestModelResolver();
-
- URLArtifactProcessorExtensionPoint documentProcessors = new DefaultURLArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
- documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors);
-
- // Create StAX processors
- DefaultStAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
- ExtensibleStAXArtifactProcessor staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
- staxProcessors.addArtifactProcessor(new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor));
- staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
- staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
- staxProcessors.addArtifactProcessor(new SCADefinitionsProcessor(policyFactory, staxProcessor, resolver));
- staxProcessors.addArtifactProcessor(new SimpleIntentProcessor(policyFactory, staxProcessor));
- staxProcessors.addArtifactProcessor(new ProfileIntentProcessor(policyFactory, staxProcessor));
- staxProcessors.addArtifactProcessor(new QualifiedIntentProcessor(policyFactory, staxProcessor));
- staxProcessors.addArtifactProcessor(new PolicySetProcessor(policyFactory, staxProcessor));
- staxProcessors.addArtifactProcessor(new MockPolicyProcessor());
-
- // Create document processors
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
- documentProcessors.addArtifactProcessor(new CompositeDocumentProcessor(staxProcessor, inputFactory, scaDefnSink));
- documentProcessors.addArtifactProcessor(new ComponentTypeDocumentProcessor(staxProcessor, inputFactory));
- documentProcessors.addArtifactProcessor(new ConstrainingTypeDocumentProcessor(staxProcessor, inputFactory));
- scaDefnDocProcessor = new SCADefinitionsDocumentProcessor(staxProcessors, staxProcessor, inputFactory, policyFactory);
- documentProcessors.addArtifactProcessor(scaDefnDocProcessor);
- }
-
- @Override
- public void tearDown() throws Exception {
- }
-
- 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)scaDefnDocProcessor.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/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolveTestCase.java b/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolveTestCase.java
deleted file mode 100644
index 6f0ef3ad96..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolveTestCase.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.xml;
-
-import java.io.InputStream;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-
-/**
- * Test resolving SCA XML assemblies.
- *
- * @version $Rev: 638855 $ $Date: 2008-03-19 08:04:32 -0700 (Wed, 19 Mar 2008) $
- */
-public class ResolveTestCase extends TestCase {
-
- private XMLInputFactory inputFactory;
- private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
- private ExtensibleStAXArtifactProcessor staxProcessor;
- private TestModelResolver resolver;
- private AssemblyFactory factory;
- private PolicyFactory policyFactory;
-
- @Override
- public void setUp() throws Exception {
- factory = new DefaultAssemblyFactory();
- policyFactory = new DefaultPolicyFactory();
- inputFactory = XMLInputFactory.newInstance();
- staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
- resolver = new TestModelResolver();
- }
-
- @Override
- public void tearDown() throws Exception {
- }
-
- public void testResolveConstrainingType() throws Exception {
- InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
- ConstrainingTypeProcessor constrainingTypeReader = new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor);
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- ConstrainingType constrainingType = constrainingTypeReader.read(reader);
- is.close();
- assertNotNull(constrainingType);
- resolver.addModel(constrainingType);
-
- is = getClass().getResourceAsStream("TestAllCalculator.composite");
- CompositeProcessor compositeReader = new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor);
- reader = inputFactory.createXMLStreamReader(is);
- Composite composite = compositeReader.read(reader);
- is.close();
- assertNotNull(composite);
-
- compositeReader.resolve(composite, resolver);
-
- assertEquals(composite.getConstrainingType(), constrainingType);
- assertEquals(composite.getComponents().get(0).getConstrainingType(), constrainingType);
- }
-
- public void testResolveComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("Calculator.composite");
- CompositeProcessor compositeReader = new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor);
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- Composite nestedComposite = compositeReader.read(reader);
- is.close();
- assertNotNull(nestedComposite);
- resolver.addModel(nestedComposite);
-
- is = getClass().getResourceAsStream("TestAllCalculator.composite");
- compositeReader = new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor);
- reader = inputFactory.createXMLStreamReader(is);
- Composite composite = compositeReader.read(reader);
- is.close();
-
- compositeReader.resolve(composite, resolver);
-
- assertEquals(composite.getComponents().get(2).getImplementation(), nestedComposite);
- }
-
-}
diff --git a/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestModelResolver.java b/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestModelResolver.java
deleted file mode 100644
index 5b9292cb17..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestModelResolver.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.xml;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-
-/**
- * A default implementation of an artifact resolver, based on a map.
- *
- * @version $Rev: 560306 $ $Date: 2007-07-27 09:31:44 -0700 (Fri, 27 Jul 2007) $
- */
-public class TestModelResolver implements ModelResolver {
- private static final long serialVersionUID = -7826976465762296634L;
-
- private Map<Object, Object> map = new HashMap<Object, Object>();
-
- public TestModelResolver() {
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
- Object resolved = map.get(unresolved);
- if (resolved != null) {
-
- // Return the resolved object
- return modelClass.cast(resolved);
-
- } else {
-
- // Return the unresolved object
- return unresolved;
- }
- }
-
- public void addModel(Object resolved) {
- map.put(resolved, resolved);
- }
-
- public Object removeModel(Object resolved) {
- return map.remove(resolved);
- }
-
-}
diff --git a/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingFactoryImpl.java b/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingFactoryImpl.java
deleted file mode 100644
index b28a01e156..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingFactoryImpl.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.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: 563772 $ $Date: 2007-08-07 23:50:49 -0700 (Tue, 07 Aug 2007) $
- */
-public class TestSCABindingFactoryImpl implements SCABindingFactory {
- public SCABinding createSCABinding() {
- return new TestSCABindingImpl();
- }
-
-}
diff --git a/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java b/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java
deleted file mode 100644
index acbd44dbc9..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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: 620307 $ $Date: 2008-02-10 10:56:51 -0800 (Sun, 10 Feb 2008) $
- */
-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;
-
- List<Intent> requiredIntents = new ArrayList<Intent>();
- List<PolicySet> policySets = new ArrayList<PolicySet>();
- IntentAttachPointType bindingType = new TestSCABindingType();
- 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/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java b/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java
deleted file mode 100644
index 8512dcefa1..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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.XMLOutputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.definitions.xml.SCADefinitionsDocumentProcessor;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
-import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-
-/**
- * Test the wiring of SCA XML assemblies.
- *
- * @version $Rev: 637129 $ $Date: 2008-03-14 08:11:59 -0700 (Fri, 14 Mar 2008) $
- */
-public class WireTestCase extends TestCase {
-
- private XMLInputFactory inputFactory;
- private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
- private ExtensibleStAXArtifactProcessor staxProcessor;
- private TestModelResolver resolver;
- private AssemblyFactory assemblyFactory;
- private SCABindingFactory scaBindingFactory;
- private PolicyFactory policyFactory;
- private InterfaceContractMapper mapper;
- private SCADefinitionsDocumentProcessor scaDefnDocProcessor;
-
- @Override
- public void setUp() throws Exception {
- inputFactory = XMLInputFactory.newInstance();
- staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
- resolver = new TestModelResolver();
- assemblyFactory = new DefaultAssemblyFactory();
- scaBindingFactory = new TestSCABindingFactoryImpl();
- policyFactory = new DefaultPolicyFactory();
- mapper = new InterfaceContractMapperImpl();
-
- scaDefnDocProcessor = new SCADefinitionsDocumentProcessor(staxProcessors, staxProcessor, inputFactory, policyFactory);
-
- }
-
- @Override
- public void tearDown() throws Exception {
- }
-
- public void testResolveConstrainingType() throws Exception {
- InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
- ConstrainingTypeProcessor constrainingTypeReader = new ConstrainingTypeProcessor(assemblyFactory, policyFactory, staxProcessor);
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- ConstrainingType constrainingType = constrainingTypeReader.read(reader);
- is.close();
- assertNotNull(constrainingType);
- resolver.addModel(constrainingType);
-
- is = getClass().getResourceAsStream("TestAllCalculator.composite");
- CompositeProcessor compositeReader = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
- reader = inputFactory.createXMLStreamReader(is);
- Composite composite = compositeReader.read(reader);
- is.close();
- assertNotNull(composite);
-
- URL url = getClass().getResource("test_definitions.xml");
- URI uri = URI.create("test_definitions.xml");
- SCADefinitions scaDefns = (SCADefinitions)scaDefnDocProcessor.read(null, uri, url);
- assertNotNull(scaDefns);
-
- scaDefnDocProcessor.resolve(scaDefns, resolver);
-
- compositeReader.resolve(composite, resolver);
- CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
- compositeUtil.build(composite);
-
- assertEquals(composite.getConstrainingType(), constrainingType);
- assertEquals(composite.getComponents().get(0).getConstrainingType(), constrainingType);
- }
-
- public void testResolveComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("Calculator.composite");
- CompositeProcessor compositeReader = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- Composite nestedComposite = compositeReader.read(reader);
- is.close();
- assertNotNull(nestedComposite);
- resolver.addModel(nestedComposite);
-
- is = getClass().getResourceAsStream("TestAllCalculator.composite");
- compositeReader = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
- reader = inputFactory.createXMLStreamReader(is);
- Composite composite = compositeReader.read(reader);
- is.close();
-
- URL url = getClass().getResource("test_definitions.xml");
- URI uri = URI.create("test_definitions.xml");
- SCADefinitions scaDefns = (SCADefinitions)scaDefnDocProcessor.read(null, uri, url);
- assertNotNull(scaDefns);
-
- scaDefnDocProcessor.resolve(scaDefns, resolver);
-
- compositeReader.resolve(composite, resolver);
- CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
- compositeUtil.build(composite);
-
- assertEquals(composite.getComponents().get(2).getImplementation(), nestedComposite);
- }
-
-}
diff --git a/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java b/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java
deleted file mode 100644
index aa95b98a31..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.definitions.xml.SCADefinitionsDocumentProcessor;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
-import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-
-/**
- * Test writing SCA XML assemblies.
- *
- * @version $Rev: 637129 $ $Date: 2008-03-14 08:11:59 -0700 (Fri, 14 Mar 2008) $
- */
-public class WriteAllTestCase extends TestCase {
- private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
- private ExtensibleStAXArtifactProcessor staxProcessor;
- private TestModelResolver resolver;
- private AssemblyFactory assemblyFactory;
- private SCABindingFactory scaBindingFactory;
- private PolicyFactory policyFactory;
- private InterfaceContractMapper mapper;
- private CompositeBuilderImpl compositeUtil;
- private SCADefinitionsDocumentProcessor scaDefnDocProcessor;
-
-
- @Override
- public void setUp() throws Exception {
- assemblyFactory = new DefaultAssemblyFactory();
- scaBindingFactory = new TestSCABindingFactoryImpl();
- policyFactory = new DefaultPolicyFactory();
- mapper = new InterfaceContractMapperImpl();
- compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
- staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
- staxProcessors.addArtifactProcessor(new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor));
- staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessor));
- staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(assemblyFactory, policyFactory, staxProcessor));
- resolver = new TestModelResolver();
- scaDefnDocProcessor = new SCADefinitionsDocumentProcessor(staxProcessors, staxProcessor, XMLInputFactory.newInstance(), policyFactory);
- }
-
- @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)scaDefnDocProcessor.read(null, uri, url);
- assertNotNull(scaDefns);
- scaDefnDocProcessor.resolve(scaDefns, resolver);
-
- staxProcessor.resolve(composite, resolver);
- compositeUtil.build(composite);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, bos);
- }
-
- public void testReadWriteComponentType() throws Exception {
- InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
- ComponentType componentType = staxProcessor.read(is, ComponentType.class);
- staxProcessor.resolve(componentType, resolver);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(componentType, bos);
- }
-
- public void testReadWriteConstrainingType() throws Exception {
- InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
- ConstrainingType constrainingType = staxProcessor.read(is, ConstrainingType.class);
- staxProcessor.resolve(constrainingType, resolver);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(constrainingType, bos);
- }
-
- 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/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite b/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite
deleted file mode 100644
index 4546fddb2d..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:calc="http://calc"
- targetNamespace="http://calc"
- name="Calculator">
-
- <service name="CalculatorService" promote="CalculatorServiceComponent">
- <interface.java interface="calculator.CalculatorService"/>
- </service>
-
- <component name="CalculatorServiceComponent">
- <implementation.java class="calculator.CalculatorServiceImpl"/>
- <reference name="addService" target="AddServiceComponent"/>
- <reference name="subtractService" target="SubtractServiceComponent"/>
- <reference name="multiplyService" target="MultiplyServiceComponent"/>
- <reference name="divideService" target="DivideServiceComponent"/>
- </component>
-
- <component name="AddServiceComponent">
- <implementation.java class="calculator.AddServiceImpl"/>
- </component>
-
- <component name="SubtractServiceComponent">
- <implementation.java class="calculator.SubtractServiceImpl"/>
- </component>
-
- <component name="MultiplyServiceComponent">
- <implementation.java class="calculator.MultiplyServiceImpl"/>
- </component>
-
- <component name="DivideServiceComponent">
- <implementation.java class="calculator.DivideServiceImpl"/>
- </component>
-
-</composite>
diff --git a/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType b/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType
deleted file mode 100644
index 072fe8fde1..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType
+++ /dev/null
@@ -1,34 +0,0 @@
-<?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/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType b/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType
deleted file mode 100644
index 2dbecdabb7..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/JavaScriptReference.composite b/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/JavaScriptReference.composite
deleted file mode 100644
index a313dd1e6d..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/JavaScriptReference.composite
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. 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/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/RMIBindingTest.composite b/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/RMIBindingTest.composite
deleted file mode 100644
index 2da2b56e8e..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/RMIBindingTest.composite
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. 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/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllCalculator.composite b/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllCalculator.composite
deleted file mode 100644
index 5091ff700b..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllCalculator.composite
+++ /dev/null
@@ -1,128 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES 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/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllDivide.composite b/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllDivide.composite
deleted file mode 100644
index 0e7a48c698..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllDivide.composite
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES 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/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllPolicyCalculator.composite b/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllPolicyCalculator.composite
deleted file mode 100644
index 7bc7ccdb83..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllPolicyCalculator.composite
+++ /dev/null
@@ -1,129 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES 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/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/another_test_definitions.xml b/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/another_test_definitions.xml
deleted file mode 100644
index bcc8c54dc8..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/another_test_definitions.xml
+++ /dev/null
@@ -1,97 +0,0 @@
-<?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/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/test_definitions.xml b/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/test_definitions.xml
deleted file mode 100644
index b79cb6b7b7..0000000000
--- a/branches/sca-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/test_definitions.xml
+++ /dev/null
@@ -1,175 +0,0 @@
-<?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/branches/sca-android/tuscany-assembly/.classpath b/branches/sca-android/tuscany-assembly/.classpath
deleted file mode 100644
index 9c1dfd40f1..0000000000
--- a/branches/sca-android/tuscany-assembly/.classpath
+++ /dev/null
@@ -1,13 +0,0 @@
-<classpath>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
- <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
- <classpathentry kind="output" path="target/classes"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="var" path="M2_REPO/junit/junit/4.2/junit-4.2.jar"/>
- <classpathentry kind="src" path="/tuscany-definitions"/>
- <classpathentry kind="src" path="/tuscany-extensibility"/>
- <classpathentry kind="src" path="/tuscany-policy"/>
- <classpathentry kind="src" path="/tuscany-interface"/>
- <classpathentry kind="var" path="M2_REPO/org/easymock/easymock/2.2/easymock-2.2.jar"/>
-</classpath> \ No newline at end of file
diff --git a/branches/sca-android/tuscany-assembly/.project b/branches/sca-android/tuscany-assembly/.project
deleted file mode 100644
index 334e14be4d..0000000000
--- a/branches/sca-android/tuscany-assembly/.project
+++ /dev/null
@@ -1,18 +0,0 @@
-<projectDescription>
- <name>tuscany-assembly</name>
- <comment>Parent POM defining settings that can be used across Tuscany</comment>
- <projects>
- <project>tuscany-definitions</project>
- <project>tuscany-extensibility</project>
- <project>tuscany-policy</project>
- <project>tuscany-interface</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription> \ No newline at end of file
diff --git a/branches/sca-android/tuscany-assembly/.settings/org.eclipse.jdt.core.prefs b/branches/sca-android/tuscany-assembly/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 798d84aa9b..0000000000
--- a/branches/sca-android/tuscany-assembly/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,5 +0,0 @@
-#Thu Mar 20 19:19:29 PDT 2008
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.source=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
diff --git a/branches/sca-android/tuscany-assembly/DISCLAIMER b/branches/sca-android/tuscany-assembly/DISCLAIMER
deleted file mode 100644
index d68a410903..0000000000
--- a/branches/sca-android/tuscany-assembly/DISCLAIMER
+++ /dev/null
@@ -1,8 +0,0 @@
-Apache Tuscany is an effort undergoing incubation at The Apache Software
-Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is
-required of all newly accepted projects until a further review indicates that
-the infrastructure, communications, and decision making process have stabilized
-in a manner consistent with other successful ASF projects. While incubation
-status is not necessarily a reflection of the completeness or stability of the
-code, it does indicate that the project has yet to be fully endorsed by the ASF.
-
diff --git a/branches/sca-android/tuscany-assembly/LICENSE b/branches/sca-android/tuscany-assembly/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-android/tuscany-assembly/LICENSE
+++ /dev/null
@@ -1,205 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
-
diff --git a/branches/sca-android/tuscany-assembly/NOTICE b/branches/sca-android/tuscany-assembly/NOTICE
deleted file mode 100644
index 1325efd8bf..0000000000
--- a/branches/sca-android/tuscany-assembly/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${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/branches/sca-android/tuscany-assembly/pom.xml b/branches/sca-android/tuscany-assembly/pom.xml
deleted file mode 100644
index b34e5d21a1..0000000000
--- a/branches/sca-android/tuscany-assembly/pom.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for 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>2.0-incubating-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>2.0-incubating-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface</artifactId>
- <version>2.0-incubating-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-definitions</artifactId>
- <version>2.0-incubating-SNAPSHOT</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractContract.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractContract.java
deleted file mode 100644
index a234083bef..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractContract.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.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: 598005 $ $Date: 2007-11-25 08:36:27 -0800 (Sun, 25 Nov 2007) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.java
deleted file mode 100644
index 514106208d..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.policy.IntentAttachPoint;
-
-/**
- * A property allows for the configuration of an implementation with externally
- * set data values. An implementation can have zero or more properties. Each
- * property has a data type, which may be either simple or complex. An
- * implementation may also define a default value for a property.
- */
-public interface AbstractProperty extends Base, 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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractReference.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractReference.java
deleted file mode 100644
index 9cdb51dad0..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractReference.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-/**
- * Represents a reference contract.
- *
- * @version $Rev: 537384 $ $Date: 2007-05-12 04:02:56 -0700 (Sat, 12 May 2007) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractService.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractService.java
deleted file mode 100644
index 13e69cef36..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractService.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-/**
- * Represents a service contract.
- *
- * @version $Rev: 537384 $ $Date: 2007-05-12 04:02:56 -0700 (Sat, 12 May 2007) $
- */
-public interface AbstractService extends AbstractContract {
-
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java
deleted file mode 100644
index 04f0dd8b47..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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: 637192 $ $Date: 2008-03-14 11:13:01 -0700 (Fri, 14 Mar 2008) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java
deleted file mode 100644
index dba3e9f1ae..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-
-/**
- * Base interface for all assembly model objects.
- *
- * @version $Rev: 568902 $ $Date: 2007-08-23 02:32:29 -0700 (Thu, 23 Aug 2007) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java
deleted file mode 100644
index 028a10c995..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-
-/**
- * Represents a binding.
- *
- * @version $Rev: 639224 $ $Date: 2008-03-20 02:37:04 -0700 (Thu, 20 Mar 2008) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Callback.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Callback.java
deleted file mode 100644
index c8a36cc555..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Callback.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.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: 605979 $ $Date: 2007-12-20 09:01:57 -0800 (Thu, 20 Dec 2007) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java
deleted file mode 100644
index 132569ded3..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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: 637192 $ $Date: 2008-03-14 11:13:01 -0700 (Fri, 14 Mar 2008) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java
deleted file mode 100644
index 998540612b..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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: 639224 $ $Date: 2008-03-20 02:37:04 -0700 (Thu, 20 Mar 2008) $
- */
-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 type that defines this property.
- *
- * @param type the property that defines this property
- */
- void setProperty(Property property);
-
- /**
- * Returns an XPath expression referencing a property of the enclosing
- * composite.
- *
- * @return an XPath expression referencing a property of the enclosing
- * composite
- */
- String getSource();
-
- /**
- * Sets an XPath expression referencing a property of the enclosing
- * composite.
- *
- * @param source an XPath expression referencing a property of the enclosing
- * composite
- */
- void setSource(String source);
-
- /**
- * 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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.java
deleted file mode 100644
index 5ce75aa7b4..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-
-
-/**
- * An instance of a reference associated with a particular component.
- *
- * @version $Rev: 637192 $ $Date: 2008-03-14 11:13:01 -0700 (Fri, 14 Mar 2008) $
- */
-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);
-
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentService.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentService.java
deleted file mode 100644
index 74110329f5..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentService.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-
-/**
- * An addressable instance of a service associated with a particular component.
- *
- * @version $Rev: 564107 $ $Date: 2007-08-08 23:05:29 -0700 (Wed, 08 Aug 2007) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java
deleted file mode 100644
index c4ad4fa0cb..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-import java.util.List;
-
-/**
- * Describes an implementation and represents its configurable aspects.
- *
- * @version $Rev: 567222 $ $Date: 2007-08-17 20:47:14 -0700 (Fri, 17 Aug 2007) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java
deleted file mode 100644
index bd8f97910e..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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: 637192 $ $Date: 2008-03-14 11:13:01 -0700 (Fri, 14 Mar 2008) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeReference.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeReference.java
deleted file mode 100644
index 8b55127870..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeReference.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-import java.util.List;
-
-/**
- * Represents composite reference.
- *
- * @version $Rev: 537384 $ $Date: 2007-05-12 04:02:56 -0700 (Sat, 12 May 2007) $
- */
-public interface CompositeReference extends Reference {
-
- /**
- * Returns the promoted composite references.
- *
- * @return the promoted composite references
- */
- List<ComponentReference> getPromotedReferences();
-
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java
deleted file mode 100644
index 2f7b2d0da4..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-/**
- * Represents a composite service.
- *
- * @version $Rev: 566036 $ $Date: 2007-08-14 23:16:47 -0700 (Tue, 14 Aug 2007) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java
deleted file mode 100644
index a412bcee24..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.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.
- */
-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 the name of the contract to which this operation belongs
- */
- void setContractName(String contractName);
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/ConstrainingType.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/ConstrainingType.java
deleted file mode 100644
index 1bd27d07b3..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/ConstrainingType.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.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: 568902 $ $Date: 2007-08-23 02:32:29 -0700 (Thu, 23 Aug 2007) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java
deleted file mode 100644
index a717715554..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-
-/**
- * Represents a contract. A contract can be either a service or a reference.
- *
- * @version $Rev: 637192 $ $Date: 2008-03-14 11:13:01 -0700 (Fri, 14 Mar 2008) $
- */
-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;
-
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.java
deleted file mode 100644
index 1205c4ce6c..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly;
-
-import org.apache.tuscany.sca.assembly.impl.AssemblyFactoryImpl;
-
-/**
- * A factory for the assembly model.
- *
- * @version $Rev: 537384 $ $Date: 2007-05-12 04:02:56 -0700 (Sat, 12 May 2007) $
- */
-public class DefaultAssemblyFactory extends AssemblyFactoryImpl implements AssemblyFactory {
-
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.java
deleted file mode 100644
index ce998c0662..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-import java.util.List;
-
-/**
- * Base interface for extensible assembly model objects.
- *
- * @version $Rev: 568902 $ $Date: 2007-08-23 02:32:29 -0700 (Thu, 23 Aug 2007) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java
deleted file mode 100644
index ad47c4c5aa..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-/**
- * Represents a component implementation.
- *
- * @version $Rev: 596604 $ $Date: 2007-11-20 02:35:30 -0800 (Tue, 20 Nov 2007) $
- */
-public interface Implementation extends ComponentType {
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Multiplicity.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Multiplicity.java
deleted file mode 100644
index a93c3c5ee3..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Multiplicity.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-/**
- * Enumeration for multiplicity. Defines the number of wires that can connect a
- * reference to target services.
- *
- * @version $Rev: 537384 $ $Date: 2007-05-12 04:02:56 -0700 (Sat, 12 May 2007) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationsConfigurator.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationsConfigurator.java
deleted file mode 100644
index 2ca8589b1a..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationsConfigurator.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.ConfiguredOperation;
-
-/**
- * Interface to be implemented by SCA artifacts that support configuration of 'operation' child
- * elements for policies etc.
- */
-
-public interface OperationsConfigurator {
- List<ConfiguredOperation> getConfiguredOperations();
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/OptimizableBinding.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/OptimizableBinding.java
deleted file mode 100644
index 1eb2188568..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/OptimizableBinding.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-/**
- * Represent a reference binding that supports optimized SCA local wiring between component
- * references and services
- *
- * @version $Rev: 575759 $ $Date: 2007-09-14 10:09:31 -0700 (Fri, 14 Sep 2007) $
- *
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Property.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Property.java
deleted file mode 100644
index 8828e36970..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Property.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.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: 560488 $ $Date: 2007-07-27 21:18:42 -0700 (Fri, 27 Jul 2007) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java
deleted file mode 100644
index 874164e78a..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.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: 560488 $ $Date: 2007-07-27 21:18:42 -0700 (Fri, 27 Jul 2007) $
- */
-public interface Reference extends AbstractReference, Contract {
-
- /**
- * Returns a boolean value, "false" by default, which indicates that the
- * implementation wires this reference dynamically.
- *
- * @return true if the implementation wires this reference dynamically
- */
- boolean isWiredByImpl();
-
- /**
- * Sets a boolean value, "false" by default, which indicates that the
- * implementation wires this reference dynamically.
- *
- * @param wiredByImpl whether the implementation wires this reference
- * dynamically
- */
- void setWiredByImpl(boolean wiredByImpl);
-
- /**
- * Returns the targets of this reference.
- *
- * @return the targets of this reference.
- */
- List<ComponentService> getTargets();
-
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java
deleted file mode 100644
index ece8eeb028..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-/**
- * Represents an SCA binding.
- *
- * @version $Rev: 566036 $ $Date: 2007-08-14 23:16:47 -0700 (Tue, 14 Aug 2007) $
- */
-public interface SCABinding extends Binding {
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABindingFactory.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABindingFactory.java
deleted file mode 100644
index 881d7df5e4..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABindingFactory.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-
-/**
- * A factory for the SCA binding model
- *
- * @version $Rev: 538819 $ $Date: 2007-05-16 23:54:50 -0700 (Wed, 16 May 2007) $
- */
-public interface SCABindingFactory {
-
- /**
- * Create a new SCA binding.
- *
- * @return a new SCA binding
- */
- SCABinding createSCABinding();
-
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java
deleted file mode 100644
index c63bee0303..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-/**
- * Represents a service. Services are used to publish services provided by
- * implementations, so that they are addressable by other components.
- *
- * @version $Rev: 560488 $ $Date: 2007-07-27 21:18:42 -0700 (Fri, 27 Jul 2007) $
- */
-public interface Service extends AbstractService, Contract {
-
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java
deleted file mode 100644
index bd457b3c34..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-import org.apache.tuscany.sca.policy.IntentAttachPoint;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-
-/**
- * Represents a wire.
- *
- * @version $Rev: 568902 $ $Date: 2007-08-23 02:32:29 -0700 (Thu, 23 Aug 2007) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ComponentPreProcessor.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ComponentPreProcessor.java
deleted file mode 100644
index e0ac9ada03..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ComponentPreProcessor.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder;
-
-import org.apache.tuscany.sca.assembly.Component;
-
-public interface ComponentPreProcessor {
-
- void preProcess(Component component);
-
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java
deleted file mode 100644
index 050a7e5cb5..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.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: 563358 $ $Date: 2007-08-06 17:26:27 -0700 (Mon, 06 Aug 2007) $
- */
-public interface CompositeBuilder {
-
- /**
- * Build, configure and wire a composite.
- *
- * @param composite
- * @throws CompositeBuilderException
- */
- void build(Composite composite) throws CompositeBuilderException;
-
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.java
deleted file mode 100644
index c2c91f715e..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder;
-
-/**
- * Reports a composite builder exception.
- *
- * @version $Rev: 537384 $ $Date: 2007-05-12 04:02:56 -0700 (Sat, 12 May 2007) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderMonitor.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderMonitor.java
deleted file mode 100644
index 5630d19366..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderMonitor.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder;
-
-/**
- * A monitor for the composite builder.
- *
- * @version $Rev: 537384 $ $Date: 2007-05-12 04:02:56 -0700 (Sat, 12 May 2007) $
- */
-public interface CompositeBuilderMonitor {
-
- /**
- * Reports a build problem.
- *
- * @param problem
- */
- void problem(Problem problem);
-
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DomainBuilder.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DomainBuilder.java
deleted file mode 100644
index 88468938fd..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DomainBuilder.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.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
- */
- public 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
- */
- public 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
- */
- public String getComponentNameFromReference(String referenceName);
-
- /**
- * Get the service name out of the reference name that might look like Component/Service
- *
- * @param referenceName
- * @return
- */
- public String getServiceNameFromReference(String referenceName);
-
- /**
- * Find the service object given a reference name
- *
- * @param composite
- * @param referenceName
- * @return
- */
- public Service findServiceForReference(Composite composite, String referenceName);
-
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/Problem.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/Problem.java
deleted file mode 100644
index 70ec19288a..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/Problem.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder;
-
-
-/**
- * Reports a composite assembly problem.
- *
- * @version $Rev: 537384 $ $Date: 2007-05-12 04:02:56 -0700 (Sat, 12 May 2007) $
- */
-public interface Problem {
-
- public enum Severity {
- INFO,
- WARNING,
- ERROR
- }
-
- Severity getSeverity();
-
- String getMessage();
-
- Object getModel();
-
- Object getResource();
-
- Exception getCause();
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingPolicyComputer.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingPolicyComputer.java
deleted file mode 100644
index ec25c8e2a7..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingPolicyComputer.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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.Hashtable;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.ConfiguredOperation;
-import org.apache.tuscany.sca.assembly.Contract;
-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.util.PolicyComputationUtils;
-import org.apache.tuscany.sca.policy.util.PolicyValidationException;
-
-/**
- * Policy computation methods pertaining to computing Binding policies
- */
-public class BindingPolicyComputer extends PolicyComputer {
-
- public BindingPolicyComputer() {
- super();
- }
-
- public void computeBindingIntentsAndPolicySets(Contract contract) throws PolicyValidationException {
- for (Binding binding : contract.getBindings()) {
- if (binding instanceof PolicySetAttachPoint) {
- computeIntents((IntentAttachPoint)binding, contract.getRequiredIntents());
-
- aggregateAndPruneApplicablePolicySets(contract.getApplicablePolicySets(),
- ((PolicySetAttachPoint)binding).getApplicablePolicySets());
-
- computePolicySets((PolicySetAttachPoint)binding, contract.getPolicySets());
-
- 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(),
- (PolicySetAttachPoint)binding);
- }
- }
- }
-
- if ( contract.getCallback() != null ) {
- for (Binding binding : contract.getCallback().getBindings()) {
- if (binding instanceof PolicySetAttachPoint) {
- computeIntents((IntentAttachPoint)binding, contract.getCallback().getRequiredIntents());
-
- aggregateAndPruneApplicablePolicySets(contract.getApplicablePolicySets(),
- ((PolicySetAttachPoint)binding).getApplicablePolicySets());
-
- computePolicySets((PolicySetAttachPoint)binding, contract.getCallback().getPolicySets());
- }
- }
- }
- }
-
-
- private 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 void computePolicySets(PolicySetAttachPoint policiedBinding,
- List<PolicySet> inheritedPolicySets) throws PolicyValidationException {
-
- List<PolicySet> prunedPolicySets = computeInheritablePolicySets(inheritedPolicySets,
- policiedBinding.getApplicablePolicySets());
- policiedBinding.getPolicySets().addAll(prunedPolicySets);
- normalizePolicySets(policiedBinding);
- }
-
- public void determineApplicableBindingPolicySets(Contract source, Contract target) throws PolicyComputationException {
- 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) {
- new PolicyComputationException("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 void determineApplicableDomainPolicySets(Contract contract,
- PolicySetAttachPoint policiedBinding)
- throws PolicyComputationException {
- //if ( domainPolicySets != null) {
- determineApplicableDomainPolicySets(policiedBinding.getApplicablePolicySets(),
- policiedBinding,
- policiedBinding.getType());
-
- if ( policiedBinding.getRequiredIntents().size() > 0 ) {
- if ( contract instanceof Service ) {
- throw new PolicyComputationException("The following are unfulfilled intents for " +
- "binding in service - " + contract.getName() + "\nUnfulfilled Intents = " +
- policiedBinding.getRequiredIntents());
- } else {
- throw new PolicyComputationException("The are unfulfilled intents for " +
- "binding in reference - " + contract.getName() + "\nUnfulfilled Intents = " +
- policiedBinding.getRequiredIntents());
- }
- }
- //}
- }
-
- private 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 void addInheritedOpConfOnBindings(Contract contract) {
- for ( Binding binding : contract.getBindings() ) {
- if ( binding instanceof OperationsConfigurator ) {
- addInheritedOperationConfigurations(contract, (OperationsConfigurator)binding);
- }
- }
- }*/
-
- private 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());
- }
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingUtil.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingUtil.java
deleted file mode 100644
index 791d131871..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingUtil.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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
- */
-class BindingUtil {
- 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;
- }
-
-
- public static Binding matchBinding(Component component, ComponentService service, 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 ( component != null){
- cloned.setName(binding.getName() + "#" + component.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(component);
- endpoint.setTargetComponentService(service);
- 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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
deleted file mode 100644
index caa212ccdf..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly.builder.impl;
-
-import java.util.logging.Level;
-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.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderMonitor;
-import org.apache.tuscany.sca.assembly.builder.Problem;
-import org.apache.tuscany.sca.assembly.builder.Problem.Severity;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-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: 643489 $ $Date: 2008-04-01 10:06:42 -0800 (Tue, 01 Apr 2008) $
- */
-public class CompositeBuilderImpl implements CompositeBuilder {
- private final static Logger logger = Logger.getLogger(CompositeBuilderImpl.class.getName());
- private CompositeIncludeBuilderImpl includeBuilder;
- private CompositeWireBuilderImpl wireBuilder;
- private CompositeCloneBuilderImpl cloneBuilder;
- private CompositeConfigurationBuilderImpl configurationBuilder;
-
- /**
- * Constructs a new composite util.
- *
- * @param assemblyFactory
- * @param interfaceContractMapper
- */
- public CompositeBuilderImpl(AssemblyFactory assemblyFactory,
- SCABindingFactory scaBindingFactory,
- IntentAttachPointTypeFactory intentAttachPointTypeFactory,
- InterfaceContractMapper interfaceContractMapper,
- CompositeBuilderMonitor monitor) {
-
- if (monitor == null) {
- // Create a default monitor that logs using the JDK logger.
- monitor = new CompositeBuilderMonitor() {
- 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());
- }
- }
- }
- };
- }
-
- includeBuilder = new CompositeIncludeBuilderImpl(monitor);
- wireBuilder = new CompositeWireBuilderImpl(assemblyFactory, interfaceContractMapper, monitor);
- cloneBuilder = new CompositeCloneBuilderImpl(monitor);
- configurationBuilder = new CompositeConfigurationBuilderImpl(assemblyFactory, scaBindingFactory, intentAttachPointTypeFactory, interfaceContractMapper, monitor);
-
- }
-
- public CompositeBuilderImpl(AssemblyFactory assemblyFactory,
- SCABindingFactory scaBindingFactory,
- IntentAttachPointTypeFactory intentAttachPointTypeFactory,
- InterfaceContractMapper interfaceContractMapper,
- CompositeBuilderMonitor monitor,
- SCADefinitions scaDefns) {
- this(assemblyFactory, scaBindingFactory, intentAttachPointTypeFactory, interfaceContractMapper, monitor);
- configurationBuilder.setScaDefinitions(scaDefns);
- }
-
- public void build(Composite composite) throws CompositeBuilderException {
-
- // Collect and fuse includes
- includeBuilder.fuseIncludes(composite);
-
- // Expand nested composites
- cloneBuilder.expandCompositeImplementations(composite);
-
- // Configure all components
- configurationBuilder.configureComponents(composite);
-
- // Wire the composite
- wireBuilder.wireComposite(composite);
-
- // Activate composite services
- configurationBuilder.activateCompositeServices(composite);
-
- // Wire composite references
- wireBuilder.wireCompositeReferences(composite);
-
- // Fuse nested composites
- //cloneBuilder.fuseCompositeImplementations(composite);
- }
-
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java
deleted file mode 100644
index 142bed9d63..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.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.CompositeBuilderMonitor;
-
-public class CompositeCloneBuilderImpl {
-
- public CompositeCloneBuilderImpl(CompositeBuilderMonitor monitor) {
- }
-
- /**
- * Expand composite component implementations.
- *
- * @param composite
- * @param problems
- */
- public 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
- */
- public 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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java
deleted file mode 100644
index 9040b8bd99..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java
+++ /dev/null
@@ -1,1417 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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 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.CompositeService;
-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.ComponentPreProcessor;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderMonitor;
-import org.apache.tuscany.sca.assembly.builder.Problem.Severity;
-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.policy.IntentAttachPoint;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-
-public class CompositeConfigurationBuilderImpl {
- private final static String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
- private final static String BINDING_SCA = "binding.sca";
- private final static QName BINDING_SCA_QNAME = new QName(SCA10_NS, BINDING_SCA);
-
- private AssemblyFactory assemblyFactory;
- private SCABindingFactory scaBindingFactory;
- private CompositeBuilderMonitor monitor;
- private InterfaceContractMapper interfaceContractMapper;
- private IntentAttachPointTypeFactory intentAttachPointTypeFactory;
- private SCADefinitions scaDefinitions = null;
-
- public CompositeConfigurationBuilderImpl(AssemblyFactory assemblyFactory,
- SCABindingFactory scaBindingFactory,
- IntentAttachPointTypeFactory intentAttachPointTypeFactory,
- InterfaceContractMapper interfaceContractMapper,
- CompositeBuilderMonitor monitor) {
- this.assemblyFactory = assemblyFactory;
- this.scaBindingFactory = scaBindingFactory;
- this.intentAttachPointTypeFactory = intentAttachPointTypeFactory;
- this.interfaceContractMapper = interfaceContractMapper;
- this.monitor = monitor;
- }
-
- /**
- * Configure components in the composite.
- *
- * @param composite
- * @param problems
- */
- public 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())) {
- warning("Duplicate component name: " + composite.getName()
- + " : "
- + component.getName(), composite);
- } else {
- components.put(component.getName(), component);
- }
-
- // Propagate the autowire flag from the composite to components
- if (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) {
- monitor.problem(new ProblemImpl(Severity.WARNING, message, model));
- }
-
- /**
- * Reconcile component properties and the properties defined by the
- * component type.
- *
- * @param component
- * @param properties
- * @param componentProperties
- * @param problems
- */
- private void reconcileProperties(Component component,
- Map<String, Property> properties,
- Map<String, ComponentProperty> componentProperties) {
-
- // Connect component properties to their properties
- for (ComponentProperty componentProperty : component.getProperties()) {
- Property property = properties.get(componentProperty.getName());
- if (property != null) {
- componentProperty.setProperty(property);
- } else {
- warning("Property not found for component property: " + component.getName()
- + "/"
- + componentProperty.getName(), component);
- }
- }
-
- // Create component properties for all properties
- if (component.getImplementation() != null) {
- for (Property property : component.getImplementation().getProperties()) {
- if (!componentProperties.containsKey(property.getName())) {
- ComponentProperty componentProperty = assemblyFactory.createComponentProperty();
- componentProperty.setName(property.getName());
- componentProperty.setMany(property.isMany());
- componentProperty.setXSDElement(property.getXSDElement());
- componentProperty.setXSDType(property.getXSDType());
- componentProperty.setProperty(property);
- component.getProperties().add(componentProperty);
- }
- }
- }
-
- // Reconcile component properties and their properties
- for (ComponentProperty componentProperty : component.getProperties()) {
- Property property = componentProperty.getProperty();
- if (property != null) {
-
- // Check that a component property does not override the
- // mustSupply attribute
- if (!property.isMustSupply() && componentProperty.isMustSupply()) {
- warning("Component property mustSupply attribute incompatible with property: " + component
- .getName()
- + "/"
- + componentProperty.getName(),
- component);
- }
-
- // Default to the mustSupply attribute specified on the property
- if (!componentProperty.isMustSupply())
- componentProperty.setMustSupply(property.isMustSupply());
-
- // Default to the value specified on the property
- if (componentProperty.getValue() == null) {
- componentProperty.setValue(property.getValue());
- }
-
- // 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("No value configured on a mustSupply property: " + component.getName()
- + "/"
- + componentProperty.getName(), component);
- }
-
- // Check that a a component property does not override the
- // many attribute
- if (!property.isMany() && componentProperty.isMany()) {
- warning("Component property many attribute incompatible with property: " + component
- .getName()
- + "/"
- + componentProperty.getName(),
- component);
- }
-
- // Default to the many attribute defined on the property
- componentProperty.setMany(property.isMany());
-
- // Default to the type and element defined on the property
- if (componentProperty.getXSDType() == null) {
- componentProperty.setXSDType(property.getXSDType());
- }
- if (componentProperty.getXSDElement() == null) {
- componentProperty.setXSDElement(property.getXSDElement());
- }
-
- // Check that a type or element are specified
- if (componentProperty.getXSDElement() == null && componentProperty.getXSDType() == null) {
- warning("No type specified on component property: " + component.getName()
- + "/"
- + componentProperty.getName(), component);
- }
- }
- }
- }
-
- /**
- * 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$.")) {
- warning("Reference not found for component reference: " + component.getName()
- + "/"
- + componentReference.getName(), component);
- }
- }
- }
-
- // Create a component reference for each reference
- if (component.getImplementation() != null) {
- for (Reference reference : component.getImplementation().getReferences()) {
- if (!componentReferences.containsKey(reference.getName())) {
- ComponentReference componentReference =
- assemblyFactory.createComponentReference();
- componentReference.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 (!ReferenceUtil.isValidMultiplicityOverride(reference.getMultiplicity(),
- componentReference
- .getMultiplicity())) {
- warning("Component reference multiplicity incompatible with reference multiplicity: " + component
- .getName()
- + "/"
- + componentReference.getName(),
- component);
- }
- } else {
- componentReference.setMultiplicity(reference.getMultiplicity());
- }
-
- // Reconcile interface
- if (componentReference.getInterfaceContract() != null) {
- if (!componentReference.getInterfaceContract().equals(reference
- .getInterfaceContract())) {
- if (!interfaceContractMapper.isCompatible(reference.getInterfaceContract(),
- componentReference
- .getInterfaceContract())) {
- warning("Component reference interface incompatible with reference interface: " + component
- .getName()
- + "/"
- + componentReference.getName(),
- component);
- }
- }
- } else {
- componentReference.setInterfaceContract(reference.getInterfaceContract());
- }
-
- // Reconcile bindings
- if (componentReference.getBindings().isEmpty()) {
- componentReference.getBindings().addAll(reference.getBindings());
- }
-
- // 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("Service not found for component service: " + component.getName()
- + "/"
- + componentService.getName(), component);
- }
- }
-
- // Create a component service for each service
- if (component.getImplementation() != null) {
- for (Service service : component.getImplementation().getServices()) {
- if (!componentServices.containsKey(service.getName())) {
- ComponentService componentService = assemblyFactory.createComponentService();
- componentService.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
- if (componentService.getInterfaceContract() != null) {
- if (!componentService.getInterfaceContract().equals(service
- .getInterfaceContract())) {
- if (!interfaceContractMapper.isCompatible(componentService
- .getInterfaceContract(), service.getInterfaceContract())) {
- warning("Component service interface incompatible with service interface: " + component
- .getName()
- + "/"
- + componentService.getName(),
- component);
- }
- }
- } else {
- componentService.setInterfaceContract(service.getInterfaceContract());
- }
-
- // Reconcile bindings
- if (componentService.getBindings().isEmpty()) {
- componentService.getBindings().addAll(service.getBindings());
- }
-
- // Reconcile 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("Duplicate component service name: " + component.getName()
- + "/"
- + componentService.getName(), component);
- } else {
- componentServices.put(componentService.getName(), componentService);
- }
- }
- for (ComponentReference componentReference : component.getReferences()) {
- if (componentReferences.containsKey(componentReference.getName())) {
- warning("Duplicate component reference name: " + component.getName()
- + "/"
- + componentReference.getName(), component);
- } else {
- componentReferences.put(componentReference.getName(), componentReference);
- }
- }
- for (ComponentProperty componentProperty : component.getProperties()) {
- if (componentProperties.containsKey(componentProperty.getName())) {
- warning("Duplicate component property name: " + component.getName()
- + "/"
- + componentProperty.getName(), component);
- } else {
- componentProperties.put(componentProperty.getName(), componentProperty);
- }
- }
-
- }
-
- 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("No implementation for component: " + component.getName(), component);
-
- } else if (implementation.isUnresolved()) {
-
- // The implementation must be fully resolved
- warning("Component implementation not found: " + component.getName()
- + " : "
- + implementation.getURI(), component);
-
- } else {
-
- // Index properties, services and references, also check for
- // duplicates
- for (Property property : implementation.getProperties()) {
- if (properties.containsKey(property.getName())) {
- warning("Duplicate property name: " + component.getName()
- + "/"
- + property.getName(), component);
- } else {
- properties.put(property.getName(), property);
- }
- }
- for (Service service : implementation.getServices()) {
- if (services.containsKey(service.getName())) {
- warning("Duplicate service name: " + component.getName()
- + "/"
- + service.getName(), component);
- } else {
- services.put(service.getName(), service);
- }
- }
- for (Reference reference : implementation.getReferences()) {
- if (references.containsKey(reference.getName())) {
- warning("Duplicate reference name: " + component.getName()
- + "/"
- + reference.getName(), component);
- } else {
- references.put(reference.getName(), reference);
- }
- }
- }
-
- }
-
- /**
- * 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;
- }
-
- /**
- * Activate composite services in nested composites.
- *
- * @param composite
- * @param problems
- */
- public void activateCompositeServices(Composite composite) {
-
- // Process nested composites recursively
- activateNestedCompositeServices(composite);
-
- // Process top level composite services
- for (Service service : composite.getServices()) {
- CompositeService compositeService = (CompositeService)service;
-
- // Get the inner most promoted service
- ComponentService promotedService = getPromotedComponentService(compositeService);
- if (promotedService != null) {
- Component promotedComponent = getPromotedComponent(compositeService);
-
- // Default to use the interface from the promoted service
- if (compositeService.getInterfaceContract() == null && promotedService.getInterfaceContract() != null) {
- compositeService.setInterfaceContract(promotedService.getInterfaceContract());
- }
-
- // Create a new component service to represent this composite
- // service on the promoted component
- 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());
- if (compositeService.getCallback() != null) {
- 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);
- }
- }
- }
-
- /**
- * Activate composite services in nested composites.
- *
- * @param composite
- * @param problems
- */
- public void activateNestedCompositeServices(Composite composite) {
-
- // Process nested composites recursively
- for (Component component : composite.getComponents()) {
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
-
- // First process nested composites
- activateNestedCompositeServices((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 inner most promoted service
- ComponentService promotedService =
- getPromotedComponentService(compositeService);
- if (promotedService != null) {
- Component promotedComponent = getPromotedComponent(compositeService);
-
- // Default to use the interface from the promoted
- // service
- if (compositeService.getInterfaceContract() == null) {
- compositeService.setInterfaceContract(promotedService
- .getInterfaceContract());
- }
- if (componentService.getInterfaceContract() == null) {
- componentService.setInterfaceContract(promotedService
- .getInterfaceContract());
- }
-
- // Create a new component service to represent this
- // composite service on the promoted component
- 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());
- if (compositeService.getCallback() != null) {
- 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);
- }
- }
- }
- }
- }
- }
-
- /**
- * @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 {
- PropertyUtil.sourceComponentProperties(compositeProperties, component);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- Implementation impl = component.getImplementation();
- if (impl instanceof Composite) {
- configureSourcedProperties((Composite)impl, component.getProperties());
- }
- }
- }
-
- /**
- * 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 inner most (non composite)
- * component.
- *
- * @param compositeService
- * @return
- */
- private 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;
- }
- }
-
- 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();
-
- if ( scaDefinitions != null ) {
- for ( IntentAttachPointType attachPointType : scaDefinitions.getBindingTypes() ) {
- if ( attachPointType.getName().equals(BINDING_SCA_QNAME)) {
- ((IntentAttachPoint)scaBinding).setType(attachPointType);
- }
- }
- }
-
- return scaBinding;
- }
-
- /**
- * 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.
- *
- * 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
- */
- public 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);
- }
- }
- }
- }
-
- /**
- * If a binding name is not provided by the user construct it based on the service name
- *
- * @param service
- * @param binding
- */
- private void constructBindingName(Service service, Binding binding) throws CompositeBuilderException{
-
- // set the default binding name if one is required
- // if there is no name on the binding then set it to the service name
- if (binding.getName() == null){
- binding.setName(service.getName());
- }
-
- // Check that multiple bindings do not have the same name
- for (Binding otherBinding : service.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("Multiple bindings for service " +
- service.getName() +
- " have the same binding type and name " +
- binding.getName() +
- ". Tuscany SCA can't create unique URIs to differentiate these bindings ", binding);
- }
- }
- }
-
- /**
- * 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) {
- warning("URLSyntaxException when creating binding URI at component " +
- componentURIString +
- " service " +
- service.getName() +
- " binding " +
- binding.getName(),
- ex);
- }
- }
-
- /**
- * 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 String addSlashToPath(String path){
- if (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 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 = baseURI.resolve(bindingURI).toString();
- } else {
- if (includeBindingName) {
- uriString = baseURI.resolve(bindingName).toString();
- } else {
- uriString = baseURI.toString();
- }
- }
- } else {
- if (bindingURI != null ) {
- uriString = baseURI.resolve(componentURI).resolve(bindingURI).toString();
- } else {
- if (includeBindingName) {
- uriString = baseURI.resolve(componentURI).resolve(bindingName).toString();
- } else {
- uriString = baseURI.resolve(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();
- }
-
- public SCADefinitions getScaDefinitions() {
- return scaDefinitions;
- }
-
- public void setScaDefinitions(SCADefinitions scaDefinitions) {
- this.scaDefinitions = scaDefinitions;
- }
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.java
deleted file mode 100644
index cda3c5b91a..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder.impl;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderMonitor;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-
-public class CompositeIncludeBuilderImpl {
-
- public static Logger logger = Logger.getLogger(CompositeIncludeBuilderImpl.class.getName());
-
- public CompositeIncludeBuilderImpl(CompositeBuilderMonitor monitor) {
- }
-
- /**
- * 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)) {
- logger.warning("Composite " + include.getName() + " has already been included.");
- continue;
- }
-
- includes.add(include);
- visited.add(include);
- collectIncludes(include, includes, visited);
- }
- }
-
- /**
- * Copy a list of includes into a composite.
- *
- * @param composite
- */
- public 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());
- if ( composite instanceof PolicySetAttachPoint ) {
- ((PolicySetAttachPoint)composite).getPolicySets().addAll(((PolicySetAttachPoint)clone).getPolicySets());
- ((PolicySetAttachPoint)composite).getRequiredIntents().addAll(((PolicySetAttachPoint)clone).getRequiredIntents());
- }
- }
-
- // Clear the list of includes
- composite.getIncludes().clear();
- }
-
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java
deleted file mode 100644
index c7a4990230..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java
+++ /dev/null
@@ -1,998 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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.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.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.CompositeBuilderMonitor;
-import org.apache.tuscany.sca.assembly.builder.Problem.Severity;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.policy.util.PolicyComputationUtils;
-
-public class CompositeWireBuilderImpl {
-
- private CompositeBuilderMonitor monitor;
- private AssemblyFactory assemblyFactory;
- private InterfaceContractMapper interfaceContractMapper;
-
- private BindingPolicyComputer bindingPolicyComputer = null;
- private ImplementationPolicyComputer implPolicyComputer = null;
-
- //Represents a target component and service
- private class Target {
- Component component;
- ComponentService service;
-
- Target(Component component, ComponentService service) {
- this.component = component;
- this.service = service;
- }
-
- Component getComponent() {
- return component;
- }
-
- ComponentService getService() {
- return service;
- }
- };
-
- public CompositeWireBuilderImpl(AssemblyFactory assemblyFactory, InterfaceContractMapper interfaceContractMapper, CompositeBuilderMonitor monitor) {
- this.assemblyFactory = assemblyFactory;
- this.interfaceContractMapper = interfaceContractMapper;
- this.monitor = monitor;
-
- this.bindingPolicyComputer = new BindingPolicyComputer();
- this.implPolicyComputer = new ImplementationPolicyComputer();
- }
-
- /**
- * Wire component references to component services and connect promoted
- * services/references to component services/references inside a composite.
- *
- * @param composite
- */
- public void wireComposite(Composite composite) {
-
- // Wire nested composites recursively
- for (Component component : composite.getComponents()) {
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
- wireComposite((Composite)implementation);
- }
- }
-
- // Index 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 (!ReferenceUtil.validateMultiplicityAndTargets(componentReference.getMultiplicity(), componentReference
- .getTargets(), componentReference.getBindings())) {
- if (componentReference.getTargets().isEmpty()) {
-
- // No warning if the reference is promoted out of the current composite
- boolean promoted = false;
- for (Reference reference : composite.getReferences()) {
- CompositeReference compositeReference = (CompositeReference)reference;
- if (compositeReference.getPromotedReferences().contains(componentReference)) {
- promoted = true;
- break;
- }
- }
- if (!promoted && !componentReference.isCallback()) {
- warning("No targets for reference: " + componentReference.getName(), composite);
- }
- } else {
- warning("Too many targets on reference: " + componentReference.getName(), composite);
- }
- }
- }
- }
-
- /**
- * 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);
- if (!componentService.isCallback()) {
-
- // Check how many non callback 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) {
- monitor.problem(new ProblemImpl(Severity.WARNING, message, model));
- }
-
- /**
- * 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
- if (compositeService.getInterfaceContract() == null) {
- compositeService.setInterfaceContract(promotedService.getInterfaceContract());
- }
-
- } else {
- warning("Promoted component service not found: " + promotedServiceName, composite);
- }
- }
- }
-
- }
-
- /**
- * Resolves promoted references.
- *
- * @param composite
- * @param componentReferences
- * @param problems
- */
- private void connectCompositeReferences(Composite composite, Map<String, ComponentReference> componentReferences) {
-
- // Propagate interfaces from inner composite components' references to
- // their component references
- for (Component component : composite.getComponents()) {
- if (component.getImplementation() instanceof Composite) {
- for (ComponentReference componentReference : component.getReferences()) {
- Reference reference = componentReference.getReference();
- if (reference != null) {
- if (componentReference.getInterfaceContract() == null) {
- componentReference.setInterfaceContract(reference.getInterfaceContract());
- }
- }
- }
- }
- }
-
- // Connect composite references to the component references
- // that they promote
- for (Reference reference : composite.getReferences()) {
- CompositeReference compositeReference = (CompositeReference)reference;
- List<ComponentReference> promotedReferences = compositeReference.getPromotedReferences();
- for (int i = 0, n = promotedReferences.size(); i < n; i++) {
- ComponentReference componentReference = promotedReferences.get(i);
- if (componentReference.isUnresolved()) {
- String componentReferenceName = componentReference.getName();
- componentReference = componentReferences.get(componentReferenceName);
- if (componentReference != null) {
-
- // Point to the resolved component reference
- promotedReferences.set(i, componentReference);
-
- // Use the interface contract from the component
- // reference if none
- // is specified on the composite reference
- if (compositeReference.getInterfaceContract() == null) {
- compositeReference.setInterfaceContract(componentReference.getInterfaceContract());
- }
-
- } else {
- warning("Promoted component reference not found: " + componentReferenceName, composite);
- }
- }
- }
- }
- }
-
- private List<Target> createComponentReferenceTargets(Composite composite,
- Map<String, Component> components,
- Map<String, ComponentService> componentServices,
- ComponentReference componentReference) {
- List<Target> targets = new ArrayList<Target>();
-
- 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()) {
- for (ComponentService targetComponentService : targetComponent.getServices()) {
- if (componentReference.getInterfaceContract() == null ||
- interfaceContractMapper.isCompatible(componentReference.getInterfaceContract(), targetComponentService.getInterfaceContract())) {
- Target target = new Target(targetComponent, targetComponentService);
- targets.add(target);
- if (multiplicity == Multiplicity.ZERO_ONE || multiplicity == Multiplicity.ONE_ONE) {
- break;
- }
- }
- }
- }
-
- if (multiplicity == Multiplicity.ONE_N || multiplicity == Multiplicity.ONE_ONE) {
- if (targets.size() == 0) {
- warning("No target services found for the component reference to be autowired: " + componentReference
- .getName(),
- componentReference);
- }
- }
-
- } else if (!componentReference.getTargets().isEmpty()) {
-
- // 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())) {
-
- Target target = new Target(targetComponent, targetComponentService);
- targets.add(target);
-
- // 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("Incompatible interfaces on component reference and target: " + componentReference
- .getName()
- + " : "
- + componentService.getName(),
- composite);
- }
- } 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.
-
- warning("Component reference target not found, it might be a remote service: " + componentService.getName(), composite);
- }
- }
- } 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())) {
-
- Target target = new Target(targetComponent, targetComponentService);
- targets.add(target);
-
- // 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("Incompatible interfaces on component reference and target: " + componentReference
- .getName()
- + " : "
- + componentService.getName(),
- composite);
- }
- } 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.
-
- warning("Component reference target from component type not found, it might be a remote service: " + componentService.getName(), composite);
- }
- }
- }
- return targets;
- }
-
-
- /**
- * 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<Target> targets = createComponentReferenceTargets(composite,
- components,
- componentServices,
- componentReference);
-
- // Select the reference bindings matching the target service bindings
- List<Binding> selectedBindings = new ArrayList<Binding>();
-
- // Handle callback
- boolean bidirectional = false;
- if (componentReference.getInterfaceContract() != null && componentReference.getInterfaceContract().getCallbackInterface() != null) {
- bidirectional = true;
- }
- List<Binding> selectedCallbackBindings = bidirectional ? new ArrayList<Binding>() : null;
-
- 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 = CompositeConfigurationBuilderImpl.getPromotedComponentService(compositeService);
- }
-
- try {
- bindingPolicyComputer.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 = BindingUtil.resolveBindings(componentReference, targetComponent, targetComponentService);
- if (selected == null) {
- warning("Component reference doesn't have a matching binding", componentReference);
- } else {
- selectedBindings.add(selected);
- }
- if (bidirectional) {
- Binding selectedCallback = BindingUtil.resolveCallbackBindings(componentReference, targetComponent, targetComponentService);
- if (selectedCallback != null) {
- selectedCallbackBindings.add(selectedCallback);
- }
- }
- }
-
- if (!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);
- }
- }
-
- // Need to tidy up the reference binding list. The situation so far...
- // Wired reference (1 or more targets are specified)
- // Binding.uri = null - remove as its 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 reference was resolved
- // Unwired reference (0 targets)
- // Binding.uri = null - Either a callback reference or the reference is yet to be wired
- // either manually or via autowire so leave the binding where it is
- // Binding.uri != null - from the composite file so leave it
- if (componentReference.getTargets().size() > 0){
- List<Binding> bindingsToRemove = new ArrayList<Binding>();
- for(Binding binding : componentReference.getBindings()){
- if(binding.getURI() == null){
- bindingsToRemove.add(binding);
- }
- }
-
- componentReference.getBindings().removeAll(bindingsToRemove);
- }
- }
- }
-
- /**
- * Resolve wires and connect the sources to their targets
- *
- * @param composite
- * @param componentServices
- * @param componentReferences
- * @param problems
- */
- private void connectWires(Composite composite,
- Map<String, ComponentService> componentServices,
- Map<String, ComponentReference> componentReferences) {
-
- // For each wire, resolve the source reference, the target service, and
- // add it to the list of targets of the reference
- List<Wire> wires = composite.getWires();
- for (int i = 0, n = wires.size(); i < n; i++) {
- Wire wire = wires.get(i);
-
- ComponentReference resolvedReference;
- ComponentService resolvedService;
-
- // Resolve the source reference
- ComponentReference source = wire.getSource();
- if (source != null && source.isUnresolved()) {
- resolvedReference = componentReferences.get(source.getName());
- if (resolvedReference != null) {
- wire.setSource(resolvedReference);
- } else {
- warning("Wire source not found: " + source.getName(), composite);
- }
- } else {
- resolvedReference = wire.getSource();
- }
-
- // Resolve the target service
- ComponentService target = wire.getTarget();
- if (target != null && target.isUnresolved()) {
- resolvedService = componentServices.get(target.getName());
- if (resolvedService != null) {
- wire.setTarget(target);
- } else {
- warning("Wire target not found: " + source.getName(), composite);
- }
- } else {
- resolvedService = wire.getTarget();
- }
-
- // Add the target service to the list of targets of the
- // reference
- if (resolvedReference != null && resolvedService != null) {
- // Check that the target component service provides
- // a superset of
- // the component reference interface
- if (resolvedReference.getInterfaceContract() == null || interfaceContractMapper
- .isCompatible(resolvedReference.getInterfaceContract(), resolvedService.getInterfaceContract())) {
-
- //resolvedReference.getTargets().add(resolvedService);
- resolvedReference.getTargets().add(wire.getTarget());
- } else {
- warning("Incompatible interfaces on wire source and target: " + source.getName()
- + " : "
- + target.getName(), composite);
- }
- }
- }
-
- // Clear the list of wires
- composite.getWires().clear();
- }
-
- /**
- * Wire composite references in nested composites.
- *
- * @param composite
- * @param problems
- */
- public void wireCompositeReferences(Composite composite) {
-
- // Process nested composites recursively
- for (Component component : composite.getComponents()) {
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
- wireCompositeReferences((Composite)implementation);
- }
- }
-
- // Process composite references declared in this composite
- for (Reference reference : composite.getReferences()) {
- CompositeReference compositeReference = (CompositeReference)reference;
- List<ComponentReference> promotedReferences = getPromotedComponentReferences(compositeReference);
- for (ComponentReference promotedReference : promotedReferences) {
-
- reconcileReferenceBindings(compositeReference, promotedReference);
- 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());
- }
- }
- }
- }
-
- // Process the component references declared on components
- // in this composite
- for (Component component : composite.getComponents()) {
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
- for (ComponentReference componentReference : component.getReferences()) {
- Reference implReference = componentReference.getReference();
- if (implReference != null && implReference instanceof CompositeReference) {
- CompositeReference compositeReference = (CompositeReference)implReference;
- List<ComponentReference> promotedReferences =
- getPromotedComponentReferences(compositeReference);
- for (ComponentReference promotedReference : promotedReferences) {
-
- // Override the configuration of the promoted reference
- reconcileReferenceBindings(componentReference, promotedReference);
- 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
- .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 = CompositeConfigurationBuilderImpl.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);
- }
- }
- }
- }
- }
- }
- }
-
- /**
- * Follow a reference promotion chain down to the inner most (non composite)
- * component references.
- *
- * @param compositeReference
- * @return
- */
- private List<ComponentReference> getPromotedComponentReferences(CompositeReference compositeReference) {
- List<ComponentReference> componentReferences = new ArrayList<ComponentReference>();
- collectPromotedComponentReferences(compositeReference, componentReferences);
- return componentReferences;
- }
-
- /**
- * Follow a reference promotion chain down to the inner most (non composite)
- * component references.
- *
- * @param compositeReference
- * @param componentReferences
- * @return
- */
- private void collectPromotedComponentReferences(CompositeReference compositeReference,
- List<ComponentReference> componentReferences) {
- for (ComponentReference componentReference : compositeReference.getPromotedReferences()) {
- Reference reference = componentReference.getReference();
- if (reference instanceof CompositeReference) {
-
- // Continue to follow the reference promotion chain
- collectPromotedComponentReferences((CompositeReference)reference, componentReferences);
-
- } else if (reference != null) {
-
- // Found a non-composite reference
- componentReferences.add(componentReference);
- }
- }
- }
-
- /**
- * Override the bindings for a promoted reference from an outer component
- * reference
- *
- * @param reference
- * @param promotedReference
- */
- private void reconcileReferenceBindings(Reference reference, ComponentReference promotedReference) {
- Set<Binding> bindings = new HashSet<Binding>();
- bindings.addAll(promotedReference.getBindings());
- bindings.addAll(reference.getBindings());
- promotedReference.getBindings().clear();
- for (Binding binding : bindings) {
- if ((!(binding instanceof OptimizableBinding)) || binding.getURI() != null) {
- promotedReference.getBindings().add(binding);
- }
- }
- if (promotedReference.getMultiplicity() == Multiplicity.ONE_ONE || promotedReference.getMultiplicity() == Multiplicity.ZERO_ONE) {
- if (promotedReference.getBindings().size() > 1) {
- warning("Component reference " + promotedReference.getName() + " has more than one wires",
- promotedReference);
- }
- }
- 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);
- }
- }
- }
-
- 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);
- }
- }
-
-
- public void computePolicies(Composite composite) {
-
- //compute policies for composite service bindings
- for (Service service : composite.getServices()) {
- addPoliciesFromPromotedService((CompositeService)service);
- try {
- //compute the intents for operations under service element
- bindingPolicyComputer.computeIntentsForOperations(service);
- //add or merge service operations to the binding
- //addInheritedOpConfOnBindings(service);
- bindingPolicyComputer.computeBindingIntentsAndPolicySets(service);
- bindingPolicyComputer.determineApplicableBindingPolicySets(service, null);
- } catch ( Exception e ) {
- warning("Policy related exception: " + e, 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
- bindingPolicyComputer.computeIntentsForOperations(reference);
- //addInheritedOpConfOnBindings(reference);
-
- if (compReference.getCallback() != null) {
- PolicyComputationUtils.addInheritedIntents(compReference.getRequiredIntents(),
- compReference.getCallback().getRequiredIntents());
- PolicyComputationUtils.addInheritedPolicySets(compReference.getPolicySets(),
- compReference.getCallback().getPolicySets(),
- false);
- }
-
- bindingPolicyComputer.computeBindingIntentsAndPolicySets(reference);
- bindingPolicyComputer.determineApplicableBindingPolicySets(reference, null);
- } catch ( Exception e ) {
- warning("Policy related exception: " + e, e);
- //throw new RuntimeException(e);
- }
- }
-
- for (Component component : composite.getComponents()) {
- Implementation implemenation = component.getImplementation();
- try {
- implPolicyComputer.computeImplementationIntentsAndPolicySets(implemenation, component);
- } catch ( Exception e ) {
- warning("Policy related exception: " + e, 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
- bindingPolicyComputer.computeIntentsForOperations(componentService);
- //compute intents and policyset for each binding
- //addInheritedOpConfOnBindings(componentService);
- bindingPolicyComputer.computeBindingIntentsAndPolicySets(componentService);
- bindingPolicyComputer.determineApplicableBindingPolicySets(componentService, null);
-
- } catch ( Exception e ) {
- warning("Policy related exception: " + e, 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
- bindingPolicyComputer.computeIntentsForOperations(componentReference);
- //compute intents and policyset for each binding
- //addInheritedOpConfOnBindings(componentReference);
- bindingPolicyComputer.computeBindingIntentsAndPolicySets(componentReference);
- bindingPolicyComputer.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 ) {
- warning("Policy related exception: " + e, 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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/DomainWireBuilderImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/DomainWireBuilderImpl.java
deleted file mode 100644
index b2f96c30cc..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/DomainWireBuilderImpl.java
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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.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.Reference;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderMonitor;
-import org.apache.tuscany.sca.assembly.builder.DomainBuilder;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-
-public class DomainWireBuilderImpl implements DomainBuilder {
-
- private CompositeWireBuilderImpl wireBuilder;
-
- public DomainWireBuilderImpl(AssemblyFactory assemblyFactory,
- SCABindingFactory scaBindingFactory,
- IntentAttachPointTypeFactory intentAttachPointTypeFactory,
- InterfaceContractMapper interfaceContractMapper,
- CompositeBuilderMonitor monitor) {
- wireBuilder = new CompositeWireBuilderImpl(assemblyFactory, interfaceContractMapper, monitor);
- }
-
- public String getComponentNameFromReference(String referenceName){
- // Extract the component name
- String componentName = referenceName;
- int i = referenceName.indexOf('/');
- if (i != -1) {
- componentName = referenceName.substring(0, i);
- }
-
- return componentName;
- }
-
- public String getServiceNameFromReference(String referenceName){
- // Extract the component name
- String serviceName = null;
- int i = referenceName.indexOf('/');
- if (i != -1) {
- serviceName = referenceName.substring(i + 1);
-
- }
- return serviceName;
- }
-
-
- public List<Reference> findReferenceForService(Composite composite, String serviceName){
-
- List<Reference> referenceList = new ArrayList<Reference>();
-
- String componentName = getComponentNameFromReference(serviceName);
-
- for (Reference reference: composite.getReferences()) {
- for (ComponentService componentService : reference.getTargets()){
- if (componentService.getName().equals(serviceName) ||
- componentService.getName().equals(componentName)) {
- referenceList.add(reference);
- }
- }
- }
-
- for (Component component: composite.getComponents()) {
- for (ComponentReference reference: component.getReferences()) {
- for (ComponentService componentService : reference.getTargets()){
- if (componentService.getName().equals(serviceName) ||
- componentService.getName().equals(componentName)) {
- referenceList.add(reference);
- }
- }
- }
- }
-
- return referenceList;
- }
-
- public List<Reference> findDomainLevelReferenceForService(Composite composite, String referenceName){
- List<Reference> referenceList = new ArrayList<Reference>();
-
- for (Composite tmpComposite : composite.getIncludes()) {
- List<Reference> tmpReferenceList = findReferenceForService(tmpComposite, referenceName);
-
- referenceList.addAll(tmpReferenceList);
- }
-
- return referenceList;
- }
-
- public Service findServiceForReference(Composite composite, String referenceName){
-
- String componentName = getComponentNameFromReference(referenceName);
- String serviceName = getServiceNameFromReference(referenceName);
-
- for (Service service: composite.getServices()) {
- if (service.getName().equals(serviceName)){
- return service;
- }
- }
-
- for (Component component: composite.getComponents()) {
- if (component.getName().equals(componentName)){
- if (component.getServices().size() > 1) {
- for (Service service: component.getServices()) {
- if (service.getName().equals(serviceName)){
- return service;
- }
- }
- } else if (component.getServices().size() == 1) {
- return component.getServices().get(0);
- }
- }
- }
-
- return null;
- }
-
- public Service findDomainLevelService(Composite composite, String referenceName){
- Service service = null;
-
- for (Composite tmpComposite : composite.getIncludes()) {
- service = findServiceForReference(tmpComposite, referenceName);
- if (service != null) {
- break;
- }
- }
-
- return service;
- }
-
- public void updateDomainLevelServiceURI(Composite domainLevelComposite, String referenceName, String bindingClassName, String URI){
-
- String componentName = getComponentNameFromReference(referenceName);
- String serviceName = getServiceNameFromReference(referenceName);
-
- // get the named service
- Service service = null;
- for(Composite composite : domainLevelComposite.getIncludes()) {
- service = findServiceForReference(composite, referenceName);
- if (service != null){
- break;
- }
- }
-
- if (service != null) {
- // find the named binding
- for (Binding binding : service.getBindings()){
- if (binding.getClass().getName().equals(bindingClassName)){
- binding.setURI(URI);
- break;
- }
- }
- }
- }
-
- public List<Composite> wireDomain(Composite domainLevelComposite){
- List<Composite> changedComposites = new ArrayList<Composite>();
-
- // process wires
-
- // autowire
-
- // wire by impl?
-
- // process all wired references
- for(Composite composite : domainLevelComposite.getIncludes()) {
- boolean compositeChanged = false;
- for(Component component : composite.getComponents()){
- for (Reference reference : component.getReferences()){
- for (ComponentService targetService : reference.getTargets()){
- String targetName = targetService.getName();
- String componentName = getComponentNameFromReference(targetName);
- String serviceName = getServiceNameFromReference(targetName);
-
- Service service = null;
- Component serviceComponent = null;
-
- // find the real target service in the domain
- for(Composite tmpComposite : domainLevelComposite.getIncludes()) {
- for (Component tmpComponent: tmpComposite.getComponents()) {
- if (tmpComponent.getName().equals(componentName)){
- serviceComponent = tmpComponent;
- if (tmpComponent.getServices().size() > 1) {
- for (Service tmpService: tmpComponent.getServices()) {
- if (tmpService.getName().equals(serviceName)){
- service = tmpService;
- break;
- }
- }
- } else if (tmpComponent.getServices().size() == 1) {
- service = tmpComponent.getServices().get(0);
- break;
- }
- }
- }
- }
-
- if ( targetService.isUnresolved()){
-
- if (service != null){
- // Find the binding already in use for this target
- Binding binding = null;
-
- for (Binding tmpBinding : reference.getBindings()){
- if ((tmpBinding.getName() != null) &&
- (tmpBinding.getName().startsWith(reference.getName() + "#" + targetName))){
- binding = tmpBinding;
- }
- }
-
- // Resolve the binding that should be used for this target
- // TODO - hang onto the old bindings at the domain level, i.e.
- // don't rely on the target objects as we still need the
- // bindings if we are going to do autowiring
- List<Binding> source = targetService.getBindings();
- List<Binding> target = service.getBindings();
- Binding newBinding = BindingUtil.matchBinding(serviceComponent, (ComponentService)service, source, target);
-
- // update the existing binding to the new binding if required
- if (newBinding != null) {
- if (binding != null){
- // there is a binding already so see if the URI has changed
- if ((binding.getURI() == null) ||
- (!binding.getURI().equals(newBinding.getURI()))){
- binding.setURI(newBinding.getURI());
- compositeChanged = true;
- }
- } else {
- // this is a newly configured binding so add it
- reference.getBindings().add(newBinding);
- compositeChanged = true;
- }
- }
- } else {
- // Do nothing - the target service hasn't been contributed yet
- }
- } else {
- // find the reference binding with the right name
- for (Binding refBinding : reference.getBindings()){
- if ((refBinding.getName() != null) &&
- (refBinding.getName().startsWith(reference.getName() + "#" + targetName))){
- // find the matching service binding
- for (Binding serviceBinding : service.getBindings()){
- if (refBinding.getClass() == serviceBinding.getClass()){
- refBinding.setURI(serviceBinding.getURI());
- }
- }
- }
- }
- }
- }
- }
- }
-
- if (compositeChanged) {
- changedComposites.add(composite);
- }
- }
-
- return changedComposites;
- }
-
-
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ImplementationPolicyComputer.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ImplementationPolicyComputer.java
deleted file mode 100644
index 2bd010c489..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ImplementationPolicyComputer.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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.Component;
-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.IntentAttachPoint;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.policy.util.PolicyValidationException;
-
-/**
- * Policy computation methods pertaining to computing Implementation Policies
- */
-public class ImplementationPolicyComputer extends PolicyComputer {
-
- public ImplementationPolicyComputer() {
- super();
- }
-
- public void computeImplementationIntentsAndPolicySets(Implementation implementation, Component parent)
- throws PolicyValidationException, PolicyComputationException {
- 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);
- computePolicySetsForOperations(parent.getApplicablePolicySets(),
- (OperationsConfigurator)parent,
- (PolicySetAttachPoint)implementation);
-
- determineApplicableImplementationPolicySets(parent);
- }
- }
-
- private void determineApplicableImplementationPolicySets(Component component) throws PolicyComputationException {
- 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) {
- new PolicyComputationException("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 PolicyComputationException("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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyComputationException.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyComputationException.java
deleted file mode 100644
index ae9ed87035..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyComputationException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder.impl;
-
-/**
- * Exception to be throw for invalid policy intents / policysets
- */
-public class PolicyComputationException extends Exception {
- private static final long serialVersionUID = 506979037642587755L;
-
- public PolicyComputationException(String message) {
- super(message);
- }
-
- public PolicyComputationException(Throwable e) {
- super(e);
- }
-
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyComputer.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyComputer.java
deleted file mode 100644
index 0e290865bd..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyComputer.java
+++ /dev/null
@@ -1,372 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder.impl;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.ConfiguredOperation;
-import org.apache.tuscany.sca.assembly.OperationsConfigurator;
-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.ProfileIntent;
-import org.apache.tuscany.sca.policy.QualifiedIntent;
-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
- */
-public abstract class PolicyComputer {
-
- protected PolicyComputer() {
-
- }
-
- protected List<Intent> computeInheritableIntents(IntentAttachPointType attachPointType,
- List<Intent> inheritableIntents) throws PolicyValidationException {
- List<Intent> validInheritableIntents = new ArrayList<Intent>();
-
- //expand profile intents in inherited intents
- 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;
- }
-
- protected void expandProfileIntents(List<Intent> intents) {
- List<Intent> expandedIntents = null;
- if ( intents.size() > 0 ) {
- expandedIntents = findAndExpandProfileIntents(intents);
- intents.clear();
- intents.addAll(expandedIntents);
- }
- }
-
- protected void normalizeIntents(IntentAttachPoint intentAttachPoint) {
- //expand profile intents specified in the attachpoint (binding / implementation)
- expandProfileIntents(intentAttachPoint.getRequiredIntents());
-
- //remove duplicates and ...
- //where qualified form of intent exists retain it and remove the qualifiable intent
- filterDuplicatesAndQualifiableIntents(intentAttachPoint);
- }
-
- protected 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);
- }
- }
- }
-
-
- protected void computeIntentsForOperations(IntentAttachPoint intentAttachPoint) throws PolicyValidationException {
- if ( intentAttachPoint instanceof OperationsConfigurator ) {
- computeIntentsForOperations((OperationsConfigurator)intentAttachPoint,
- intentAttachPoint,
- intentAttachPoint.getRequiredIntents());
- }
- }
-
- protected 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
- 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 ) {
- 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);
- }
- }
- }
- }
- }
-
- protected 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;
- }
-
- protected 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() ) {
- expandProfileIntents(policySet.getProvidedIntents());
- }
- }
-
- protected void computePolicySetsForOperations(List<PolicySet> applicablePolicySets,
- PolicySetAttachPoint policySetAttachPoint)
- throws PolicyValidationException {
- if ( policySetAttachPoint instanceof OperationsConfigurator ) {
- computePolicySetsForOperations(applicablePolicySets,
- (OperationsConfigurator)policySetAttachPoint,
- policySetAttachPoint);
- }
-
- }
-
- protected 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() ) {
- expandProfileIntents(policySet.getProvidedIntents());
- }
- }
- }
-
-
- protected void trimProvidedIntents(List<Intent> requiredIntents, List<PolicySet> policySets) {
- for ( PolicySet policySet : policySets ) {
- trimProvidedIntents(requiredIntents, policySet);
- }
- }
-
- protected void determineApplicableDomainPolicySets(List<PolicySet> applicablePolicySets,
- PolicySetAttachPoint policySetAttachPoint,
- IntentAttachPointType intentAttachPointType) {
-
- if (policySetAttachPoint.getRequiredIntents().size() > 0) {
- //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) {
- 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 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 boolean isProvidedInherently(IntentAttachPointType attachPointType, Intent intent) {
- return ( attachPointType != null &&
- (( attachPointType.getAlwaysProvidedIntents() != null &&
- attachPointType.getAlwaysProvidedIntents().contains(intent) ) ||
- ( attachPointType.getMayProvideIntents() != null &&
- attachPointType.getMayProvideIntents().contains(intent) )
- ) );
- }
-
- private 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 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 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 ");
- }
- }
- }
- }
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtil.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtil.java
deleted file mode 100644
index e50d65f1d3..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtil.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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: 639224 $ $Date: 2008-03-20 02:37:04 -0700 (Thu, 20 Mar 2008) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ProblemImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ProblemImpl.java
deleted file mode 100644
index 32a39fbb5f..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ProblemImpl.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder.impl;
-
-import org.apache.tuscany.sca.assembly.builder.Problem;
-
-/**
- * Reports a composite assembly problem.
- *
- * @version $Rev: 589508 $ $Date: 2007-10-28 23:23:26 -0700 (Sun, 28 Oct 2007) $
- */
-public class ProblemImpl implements Problem {
-
- private String message;
- private Severity severity;
- private Object model;
- private Object resource;
- private Exception cause;
-
- /**
- * Constructs a new problem.
- *
- * @param severity
- * @param message
- * @param model
- */
- public ProblemImpl(Severity severity, String message, Object model) {
- this.severity = severity;
- this.message = message;
- this.model = model;
- }
-
- /**
- * Constructs a new problem.
- *
- * @param severity
- * @param message
- * @param model
- * @param resource
- */
- public ProblemImpl(Severity severity, String message, Object model, Object resource) {
- this.severity = severity;
- this.message = message;
- this.model = model;
- this.resource = resource;
- }
-
- /**
- * Constructs a new problem.
- *
- * @param severity
- * @param message
- * @param cause
- */
- public ProblemImpl(Severity severity, String message, Exception cause) {
- this.severity = severity;
- this.message = message;
- this.cause = cause;
- }
-
- public Severity getSeverity() {
- return severity;
- }
-
- public String getMessage() {
- return message;
- }
-
- public Object getModel() {
- return model;
- }
-
- public Object getResource() {
- return resource;
- }
-
- public Exception getCause() {
- return cause;
- }
-
- @Override
- public String toString() {
- StringBuffer sb = new StringBuffer();
- if (message != null) {
- sb.append(message);
- }
- if (resource != null) {
- if (sb.length() != 0) {
- sb.append(" - ");
- }
- sb.append(resource.toString());
- }
- return sb.toString();
- }
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyUtil.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyUtil.java
deleted file mode 100644
index 396cf011aa..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyUtil.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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 javax.xml.xpath.XPathFactory;
-
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentProperty;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.xml.sax.InputSource;
-
-import sun.reflect.generics.reflectiveObjects.NotImplementedException;
-
-/**
- * Utility class to deal with processing of component properties that are taking values from the parent
- * composite's properties or an external file.
- */
-public class PropertyUtil {
- //private static final XPathFactory XPATH_FACTORY = XPathFactory.newInstance();
- private static final DocumentBuilderFactory DOC_BUILDER_FACTORY = DocumentBuilderFactory.newInstance();
- //private static final TransformerFactory TRANSFORMER_FACTORY = TransformerFactory.newInstance();
-
- static private Document evaluate(Document node, XPathExpression expression)
- 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 = DOC_BUILDER_FACTORY.newDocumentBuilder().newDocument();
- if (result instanceof Document) {
- return (Document)result;
- } else {
- //Element root = document.createElementNS(null, "value");
- //document.appendChild(root);
- document.appendChild(document.importNode(result, true));
- return document;
- }
- }
-
- static private Document loadFromFile(String file) throws MalformedURLException, IOException,
- TransformerException, ParserConfigurationException {
- URI uri = URI.create(file);
- // 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 = TRANSFORMER_FACTORY.newTransformer();
- //transformer.transform(streamSource, result);
- throw new NotImplementedException();
-
- //return (Document)result.getNode();
- } finally {
- if (is != null) {
- is.close();
- }
- }
- }
-
- static void sourceComponentProperties(Map<String, Property> compositeProperties,
- Component componentDefinition) throws CompositeBuilderException,
- ParserConfigurationException,
- XPathExpressionException,
- TransformerException,
- IOException {
-
- List<ComponentProperty> componentProperties = componentDefinition.getProperties();
- for (ComponentProperty aProperty : componentProperties) {
- String source = aProperty.getSource();
- String file = aProperty.getFile();
- if (source != null) {
- // $<name>/...
- int index = source.indexOf('/');
- if (index == -1) {
- // Tolerating $prop
- source = source + "/";
- index = source.length() - 1;
- }
- if (source.charAt(0) == '$') {
- String name = source.substring(1, index);
- Property compositeProp = compositeProperties.get(name);
- if (compositeProp == null) {
- throw new CompositeBuilderException("The 'source' cannot be resolved to a composite property: " + source);
- }
-
- Document compositePropDefValues = (Document)compositeProp.getValue();
-
- // FIXME: How to deal with namespaces?
- Document node = evaluate(compositePropDefValues, aProperty.getSourceXPathExpression());
-
- if (node != null) {
- aProperty.setValue(node);
- }
- } else {
- throw new CompositeBuilderException("The 'source' has an invalid value: " + source);
- }
- } else if (file != null) {
- aProperty.setValue(loadFromFile(aProperty.getFile()));
-
- }
- }
- }
-
- private static class DOMNamespaceContext implements NamespaceContext {
- private Node node;
-
- /**
- * @param node
- */
- public DOMNamespaceContext(Node node) {
- super();
- this.node = node;
- }
-
- public String getNamespaceURI(String prefix) {
- 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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceUtil.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceUtil.java
deleted file mode 100644
index d2eeb51ee7..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceUtil.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly.builder.impl;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Multiplicity;
-import org.apache.tuscany.sca.assembly.OptimizableBinding;
-
-/**
- * This class encapsulates utility methods to deal with reference definitions
- *
- */
-class ReferenceUtil {
- static boolean isValidMultiplicityOverride(Multiplicity definedMul, Multiplicity overridenMul) {
- if (definedMul != overridenMul) {
- switch (definedMul) {
- case ZERO_N:
- return overridenMul == Multiplicity.ZERO_ONE;
- case ONE_N:
- return overridenMul == Multiplicity.ONE_ONE;
- default:
- return false;
- }
- } else {
- return true;
- }
- }
-
- static boolean validateMultiplicityAndTargets(Multiplicity multiplicity,
- List<?> targets, List<Binding> bindings) {
-
- // Count targets
- int count = targets.size();
-
- //FIXME workaround, this validation is sometimes invoked too early
- // before we get a chance to init the multiplicity attribute
- if (multiplicity == null) {
- return true;
- }
-
- switch (multiplicity) {
- case ZERO_N:
- break;
- case ZERO_ONE:
- if (count > 1) {
- return false;
- }
- break;
- case ONE_ONE:
- if (count != 1) {
- if (count == 0) {
- for (Binding binding: bindings) {
- if (!(binding instanceof 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;
- }
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractPropertyImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractPropertyImpl.java
deleted file mode 100644
index 75cb91189b..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractPropertyImpl.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.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: 592745 $ $Date: 2007-11-07 05:36:22 -0800 (Wed, 07 Nov 2007) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractReferenceImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractReferenceImpl.java
deleted file mode 100644
index 16dc8394ce..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractReferenceImpl.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly.impl;
-
-import org.apache.tuscany.sca.assembly.AbstractReference;
-import org.apache.tuscany.sca.assembly.Multiplicity;
-
-/**
- * Represents an abstract reference
- *
- * @version $Rev: 537384 $ $Date: 2007-05-12 04:02:56 -0700 (Sat, 12 May 2007) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractServiceImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractServiceImpl.java
deleted file mode 100644
index ba58b50748..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractServiceImpl.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly.impl;
-
-import org.apache.tuscany.sca.assembly.AbstractService;
-
-/**
- * Represents an abstract service
- *
- * @version $Rev: 537384 $ $Date: 2007-05-12 04:02:56 -0700 (Sat, 12 May 2007) $
- */
-public class AbstractServiceImpl extends ContractImpl implements AbstractService {
-
- /**
- * Constructs a new abstract service.
- */
- protected AbstractServiceImpl() {
- }
-
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java
deleted file mode 100644
index 9214df05a9..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.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: 637192 $ $Date: 2008-03-14 11:13:01 -0700 (Fri, 14 Mar 2008) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BaseImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BaseImpl.java
deleted file mode 100644
index f51162598b..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BaseImpl.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly.impl;
-
-import org.apache.tuscany.sca.assembly.Base;
-
-/**
- * Convenience base class for assembly model objects.
- *
- * @version $Rev: 568902 $ $Date: 2007-08-23 02:32:29 -0700 (Thu, 23 Aug 2007) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java
deleted file mode 100644
index c8af31eee8..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.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: 620307 $ $Date: 2008-02-10 10:56:51 -0800 (Sun, 10 Feb 2008) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java
deleted file mode 100644
index e30ff1e725..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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: 637192 $ $Date: 2008-03-14 11:13:01 -0700 (Fri, 14 Mar 2008) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java
deleted file mode 100644
index e5aa4e2db7..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.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: 636985 $ $Date: 2008-03-13 20:48:47 -0700 (Thu, 13 Mar 2008) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.java
deleted file mode 100644
index 799e1c2e23..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.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.CompositeReference;
-import org.apache.tuscany.sca.assembly.Reference;
-
-/**
- * Represents a component reference
- *
- * @version $Rev: 571694 $ $Date: 2007-08-31 22:24:11 -0700 (Fri, 31 Aug 2007) $
- */
-public class ComponentReferenceImpl extends ReferenceImpl implements ComponentReference, Cloneable {
- private Reference reference;
- private Boolean autowire;
- private List<CompositeReference> promotedAs = new ArrayList<CompositeReference>();
- private ComponentService callbackService;
-
- /**
- * 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;
- }
-
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentServiceImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentServiceImpl.java
deleted file mode 100644
index 7432b655e9..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentServiceImpl.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.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: 564107 $ $Date: 2007-08-08 23:05:29 -0700 (Wed, 08 Aug 2007) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java
deleted file mode 100644
index a292857cd2..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.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: 637192 $ $Date: 2008-03-14 11:13:01 -0700 (Fri, 14 Mar 2008) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java
deleted file mode 100644
index 26829aa172..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.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;
-
-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;
- }
- }
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java
deleted file mode 100644
index 5d9c00ea82..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.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: 537384 $ $Date: 2007-05-12 04:02:56 -0700 (Sat, 12 May 2007) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java
deleted file mode 100644
index ad91c5ffa4..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.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: 566036 $ $Date: 2007-08-14 23:16:47 -0700 (Tue, 14 Aug 2007) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java
deleted file mode 100644
index 3bc3dfc6af..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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.
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java
deleted file mode 100644
index 5cf062821a..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.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: 592745 $ $Date: 2007-11-07 05:36:22 -0800 (Wed, 07 Nov 2007) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java
deleted file mode 100644
index 874efe45da..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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;
-
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.java
deleted file mode 100644
index 38b6cd7ce3..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.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: 568902 $ $Date: 2007-08-23 02:32:29 -0700 (Thu, 23 Aug 2007) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java
deleted file mode 100644
index 81bed59e1a..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.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: 637192 $ $Date: 2008-03-14 11:13:01 -0700 (Fri, 14 Mar 2008) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/PropertyImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/PropertyImpl.java
deleted file mode 100644
index 73604736a5..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/PropertyImpl.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.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: 620307 $ $Date: 2008-02-10 10:56:51 -0800 (Sun, 10 Feb 2008) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java
deleted file mode 100644
index 186e98cd5e..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Callback;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.policy.PolicySet;
-
-/**
- * Represents a reference.
- *
- * @version $Rev: 620307 $ $Date: 2008-02-10 10:56:51 -0800 (Sun, 10 Feb 2008) $
- */
-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>();
-
- 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 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;
- }
-
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java
deleted file mode 100644
index b01bd42a96..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Callback;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.policy.PolicySet;
-
-/**
- * Represents a reference.
- *
- * @version $Rev: 620307 $ $Date: 2008-02-10 10:56:51 -0800 (Sun, 10 Feb 2008) $
- */
-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;
- }
-
-}
diff --git a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java b/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java
deleted file mode 100644
index 2c8f426f82..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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: 620307 $ $Date: 2008-02-10 10:56:51 -0800 (Sun, 10 Feb 2008) $
- */
-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/branches/sca-android/tuscany-assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.AssemblyFactory b/branches/sca-android/tuscany-assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.AssemblyFactory
deleted file mode 100644
index 859c4bde4b..0000000000
--- a/branches/sca-android/tuscany-assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.AssemblyFactory
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-org.apache.tuscany.sca.assembly.DefaultAssemblyFactory \ No newline at end of file
diff --git a/branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java b/branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java
deleted file mode 100644
index 2c8bf309df..0000000000
--- a/branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-
-/**
- * Test building of assembly model instances using the assembly factory.
- *
- * @version $Rev: 567542 $ $Date: 2007-08-19 22:13:29 -0700 (Sun, 19 Aug 2007) $
- */
-public class AssemblyFactoryTestCase extends TestCase {
-
- AssemblyFactory factory;
-
- @Override
- public void setUp() throws Exception {
- factory = new DefaultAssemblyFactory();
- }
-
- @Override
- public void tearDown() throws Exception {
- factory = null;
- }
-
- public void testCreateComponent() {
- createComponent("AccountServiceComponent1");
- }
-
- public void testCreateComponentType() {
- createComponentType();
- }
-
- public void testCreateComposite() {
- createComposite();
- }
-
- public void testCreateConstrainingType() {
- createConstrainingType();
- }
-
- /**
- * Create a composite
- */
- Composite createComposite() {
- Composite c = factory.createComposite();
-
- Component c1 = createComponent("AccountServiceComponent1");
- c.getComponents().add(c1);
- Component c2 = createComponent("AccountServiceComponent2");
- c.getComponents().add(c2);
-
- Wire w = factory.createWire();
- w.setSource(c1.getReferences().get(0));
- w.setTarget(c2.getServices().get(0));
- c.getWires().add(w);
-
- CompositeService cs = factory.createCompositeService();
- cs.setName("AccountService");
- cs.setPromotedService(c1.getServices().get(0));
- cs.setInterfaceContract(new TestInterfaceContract(factory));
- c.getServices().add(cs);
- cs.getBindings().add(new TestBinding(factory));
-
- CompositeReference cr = factory.createCompositeReference();
- cr.setName("StockQuoteService");
- cr.getPromotedReferences().add(c2.getReferences().get(1));
- cr.setInterfaceContract(new TestInterfaceContract(factory));
- c.getReferences().add(cr);
- cr.getBindings().add(new TestBinding(factory));
-
- return c;
- }
-
- /**
- * Create a new component
- */
- Component createComponent(String name) {
- Component c = factory.createComponent();
- c.setName(name);
-
- ConstrainingType constraint = createConstrainingType();
- c.setConstrainingType(constraint);
-
- Implementation i = new TestImplementation(factory);
- c.setImplementation(i);
-
- ComponentProperty p = factory.createComponentProperty();
- p.setName("currency");
- p.setValue("USD");
- p.setMustSupply(true);
- p.setXSDType(new QName("", ""));
- p.setProperty(i.getProperties().get(0));
- c.getProperties().add(p);
-
- ComponentReference ref1 = factory.createComponentReference();
- ref1.setName("accountDataService");
- ref1.setMultiplicity(Multiplicity.ONE_ONE);
- ref1.setInterfaceContract(new TestInterfaceContract(factory));
- ref1.setReference(i.getReferences().get(0));
- c.getReferences().add(ref1);
- ref1.getBindings().add(new TestBinding(factory));
-
- ComponentReference ref2 = factory.createComponentReference();
- ref2.setName("stockQuoteService");
- ref2.setMultiplicity(Multiplicity.ONE_ONE);
- ref2.setInterfaceContract(new TestInterfaceContract(factory));
- ref2.setReference(i.getReferences().get(1));
- c.getReferences().add(ref2);
- ref2.getBindings().add(new TestBinding(factory));
-
- ComponentService s = factory.createComponentService();
- s.setName("AccountService");
- s.setInterfaceContract(new TestInterfaceContract(factory));
- s.setService(i.getServices().get(0));
- c.getServices().add(s);
- s.getBindings().add(new TestBinding(factory));
-
- return c;
- }
-
- /**
- * Create a new component type
- *
- * @return
- */
- ComponentType createComponentType() {
- ComponentType ctype = factory.createComponentType();
-
- Property p = factory.createProperty();
- p.setName("currency");
- p.setValue("USD");
- p.setMustSupply(true);
- p.setXSDType(new QName("", ""));
- ctype.getProperties().add(p);
-
- Reference ref1 = factory.createReference();
- ref1.setName("accountDataService");
- ref1.setInterfaceContract(new TestInterfaceContract(factory));
- ref1.setMultiplicity(Multiplicity.ONE_ONE);
- ctype.getReferences().add(ref1);
- ref1.getBindings().add(new TestBinding(factory));
-
- Reference ref2 = factory.createReference();
- ref2.setName("stockQuoteService");
- ref2.setInterfaceContract(new TestInterfaceContract(factory));
- ref2.setMultiplicity(Multiplicity.ONE_ONE);
- ctype.getReferences().add(ref2);
- ref2.getBindings().add(new TestBinding(factory));
-
- Service s = factory.createService();
- s.setName("AccountService");
- s.setInterfaceContract(new TestInterfaceContract(factory));
- ctype.getServices().add(s);
- s.getBindings().add(new TestBinding(factory));
-
- return ctype;
- }
-
- /**
- * Create a new constraining type
- *
- * @return
- */
- ConstrainingType createConstrainingType() {
- ConstrainingType ctype = factory.createConstrainingType();
-
- AbstractProperty p = factory.createAbstractProperty();
- p.setName("currency");
- p.setValue("USD");
- p.setMustSupply(true);
- p.setXSDType(new QName("", ""));
- ctype.getProperties().add(p);
-
- AbstractReference ref1 = factory.createAbstractReference();
- ref1.setName("accountDataService");
- ref1.setInterfaceContract(new TestInterfaceContract(factory));
- ref1.setMultiplicity(Multiplicity.ONE_ONE);
- ctype.getReferences().add(ref1);
-
- AbstractReference ref2 = factory.createAbstractReference();
- ref2.setName("stockQuoteService");
- ref2.setInterfaceContract(new TestInterfaceContract(factory));
- ref2.setMultiplicity(Multiplicity.ONE_ONE);
- ctype.getReferences().add(ref2);
-
- AbstractService s = factory.createAbstractService();
- s.setName("AccountService");
- s.setInterfaceContract(new TestInterfaceContract(factory));
- ctype.getServices().add(s);
-
- return ctype;
- }
-
-}
diff --git a/branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java b/branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java
deleted file mode 100644
index a6b594f311..0000000000
--- a/branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-
-/**
- * A test interface model.
- *
- * @version $Rev: 604880 $ $Date: 2007-12-17 06:30:07 -0800 (Mon, 17 Dec 2007) $
- */
-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;
- }
-
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-}
diff --git a/branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java b/branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java
deleted file mode 100644
index 698623ee1a..0000000000
--- a/branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
-
-/**
- * A test component implementation model.
- *
- * @version $Rev: 637192 $ $Date: 2008-03-14 11:13:01 -0700 (Fri, 14 Mar 2008) $
- */
-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/branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterface.java b/branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterface.java
deleted file mode 100644
index 8e82efd04b..0000000000
--- a/branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterface.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.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: 537744 $ $Date: 2007-05-14 01:00:18 -0700 (Mon, 14 May 2007) $
- */
-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/branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterfaceContract.java b/branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterfaceContract.java
deleted file mode 100644
index e020bdbc9a..0000000000
--- a/branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterfaceContract.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractImpl;
-
-/**
- * A test interface contract model.
- *
- * @version $Rev: 537744 $ $Date: 2007-05-14 01:00:18 -0700 (Mon, 14 May 2007) $
- */
-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/branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/TestOperation.java b/branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/TestOperation.java
deleted file mode 100644
index 996eb40b75..0000000000
--- a/branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/TestOperation.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
-
-/**
- * A test operation model.
- *
- * @version $Rev: 567542 $ $Date: 2007-08-19 22:13:29 -0700 (Sun, 19 Aug 2007) $
- */
-public class TestOperation extends OperationImpl {
-
-}
diff --git a/branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CalculateBindingURITestCase.java b/branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CalculateBindingURITestCase.java
deleted file mode 100644
index 609e1733aa..0000000000
--- a/branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CalculateBindingURITestCase.java
+++ /dev/null
@@ -1,554 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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 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.CompositeBuilderMonitor;
-import org.apache.tuscany.sca.assembly.builder.Problem;
-import org.apache.tuscany.sca.assembly.builder.Problem.Severity;
-
-public class CalculateBindingURITestCase extends TestCase {
- private final static Logger logger = Logger.getLogger(CalculateBindingURITestCase.class.getName());
- private AssemblyFactory assemblyFactory;
- private SCABindingFactory scaBindingFactory = null;
- private CompositeBuilderMonitor monitor = null;
- private CompositeConfigurationBuilderImpl configurationBuilder = null;
- private List<Binding> defaultBindings = new ArrayList<Binding>();
-
- @Override
- protected void setUp() throws Exception {
- assemblyFactory = new DefaultAssemblyFactory();
- scaBindingFactory = new TestBindingFactory();
- monitor = new CompositeBuilderMonitor() {
- 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());
- }
- }
- }
- };
- configurationBuilder = new CompositeConfigurationBuilderImpl(assemblyFactory, scaBindingFactory, null, null, monitor);
- Binding defaultBinding = new TestBindingImpl();
- defaultBinding.setURI("http://myhost:8080/root");
- defaultBindings.add(defaultBinding);
- }
-
- @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.configureBindingURIs(composite, null, defaultBindings);
-
- 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.configureBindingURIs(composite, null, defaultBindings);
-
- 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.configureBindingURIs(composite, null, defaultBindings);
-
- 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.configureBindingURIs(composite, null, defaultBindings);
-
- 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.configureBindingURIs(composite, null, defaultBindings);
-
- 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.configureBindingURIs(composite, null, defaultBindings);
-
- 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.configureBindingURIs(composite, null, defaultBindings);
-
- 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.configureBindingURIs(composite, null, defaultBindings);
-
- 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.configureBindingURIs(composite, null, defaultBindings);
-
- 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.configureBindingURIs(composite, null, defaultBindings);
-
- 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.configureBindingURIs(composite, null, defaultBindings);
-
- 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.configureBindingURIs(composite, null, defaultBindings);
-
- 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.configureBindingURIs(composite, null, defaultBindings);
-
- 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.configureBindingURIs(composite, null, defaultBindings);
-
- 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.configureBindingURIs(composite, null, defaultBindings);
-
- 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.configureBindingURIs(composite, null, defaultBindings);
-
- 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.configureBindingURIs(composite, null, defaultBindings);
- 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.configureBindingURIs(composite, null, defaultBindings);
- 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 false;
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
- }
-
-}
diff --git a/branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java b/branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java
deleted file mode 100644
index bef6b47ee7..0000000000
--- a/branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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;
-
-public class CompositeBuilderTestCase extends TestCase {
-
- private AssemblyFactory assemblyFactory;
-
- @Override
- protected void setUp() throws Exception {
- assemblyFactory = new DefaultAssemblyFactory();
- }
-
- @Override
- protected void tearDown() throws Exception {
- assemblyFactory = null;
- }
-
- public void testFuseIncludes() {
- Composite c1 = assemblyFactory.createComposite();
- c1.setName(new QName("http://foo", "C1"));
- Component a = assemblyFactory.createComponent();
- a.setName("a");
- c1.getComponents().add(a);
- CompositeService s = assemblyFactory.createCompositeService();
- s.setName("s");
- c1.getServices().add(s);
- CompositeReference r = assemblyFactory.createCompositeReference();
- r.setName("r");
- c1.getReferences().add(r);
-
- Composite c2 = assemblyFactory.createComposite();
- c2.setName(new QName("http://foo", "C2"));
- c1.getIncludes().add(c2);
- Component b = assemblyFactory.createComponent();
- b.setName("b");
- c2.getComponents().add(b);
-
- Composite c = assemblyFactory.createComposite();
- c.setName(new QName("http://foo", "C"));
- c.getIncludes().add(c1);
-
- new CompositeIncludeBuilderImpl(null).fuseIncludes(c);
-
- assertTrue(c.getComponents().get(0).getName().equals("a"));
- assertTrue(c.getComponents().get(1).getName().equals("b"));
- assertTrue(c.getServices().get(0).getName().equals("s"));
- assertTrue(c.getReferences().get(0).getName().equals("r"));
- }
-
- public void testExpandComposites() {
- Composite c1 = assemblyFactory.createComposite();
- c1.setName(new QName("http://foo", "C1"));
- Component a = assemblyFactory.createComponent();
- a.setName("a");
- c1.getComponents().add(a);
- CompositeService s = assemblyFactory.createCompositeService();
- s.setName("s");
- c1.getServices().add(s);
- CompositeReference r = assemblyFactory.createCompositeReference();
- r.setName("r");
- c1.getReferences().add(r);
-
- Composite c2 = assemblyFactory.createComposite();
- c2.setName(new QName("http://foo", "C2"));
- Component b = assemblyFactory.createComponent();
- b.setName("b");
- c2.getComponents().add(b);
-
- Composite c = assemblyFactory.createComposite();
- c.setName(new QName("http://foo", "C"));
- Component x = assemblyFactory.createComponent();
- x.setName("x");
- x.setImplementation(c1);
- c.getComponents().add(x);
- Component y = assemblyFactory.createComponent();
- y.setName("y");
- y.setImplementation(c2);
- c.getComponents().add(y);
- Component z = assemblyFactory.createComponent();
- z.setName("z");
- z.setImplementation(c1);
- c.getComponents().add(z);
-
- new CompositeCloneBuilderImpl(null).expandCompositeImplementations(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/branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java b/branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java
deleted file mode 100644
index b87ffc5905..0000000000
--- a/branches/sca-android/tuscany-assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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: 579601 $ $Date: 2007-09-26 04:25:30 -0700 (Wed, 26 Sep 2007) $
- */
-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());
- }
-}